sub foo { my ($a, $b, $c) = @_; my %hash = (a => {b => {c => 0}}); # whatever other variables you want to initialize local $SIG{__WARN__} = sub { # dump those variables here }; print $hash{$a}->{$b}->{$c}; # ... } #### local $_ = "0A72656B636148206C72655020726568746F6E41207473754A"; while(s/..$//) { print chr(hex($&)) }