Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • use Data::Dumper;
    use PadWalker qw(peek_my);
      my $lex = "HELLO";
      sub pad {
        my $l = shift;
        warn Dumper(peek_my($l));
        print "While you're here, I'll print my enclosed scalar: $lex\n";
    t sure what your expecting to see
    Based on Persistent Private Variables in perlsub it sounds like the problem is the pad sub is getting created at compile time and my is happening at runtime and this leads to the sub picking up a reference to $lex too early. This explanation is almost certainly flawed as its printing $lex correctly; Hopefully someone more cluefull with rescue us now.