use Devel::Peek; my $str = 'the key is:'; my $key = 'hello'; Dump($key); decrypt( $str, $key ); $key = 'gone!'; # $key = 'x'x100000; # a string that won't fit will change PV Dump($key); decrypt( $str, $key ); sub decrypt { warn "\nGot @_\n\n" } __DATA__ SV = PV(0x15d529c) at 0x1a8460c REFCNT = 1 FLAGS = (PADBUSY,PADMY,POK,pPOK) PV = 0x1a4a8ac "hello"\0 CUR = 5 LEN = 6 Got the key is: hello SV = PV(0x15d529c) at 0x1a8460c REFCNT = 1 FLAGS = (PADBUSY,PADMY,POK,pPOK) PV = 0x1a4a8ac "gone!"\0 CUR = 5 LEN = 6 Got the key is: gone!