First of all, install the Memcached for Perl:

perl -MCPAN -e shell
install Cache::Memcached

Here is an example script:

#!/usr/bin/perl
use Cache::Memcached;
my $cache =  new Cache::Memcached {
    'servers' => ['127.0.0.1:11211'],
 };
# Save (set) something in your cache:
$cache->set("test", "test123");
# Get the value from Memcached
my $value = $cache->get("test");