tokuhirom
8/23/2009 - 3:03 PM

hoge.pl

use strict;
use warnings;
use PadWalker qw/peek_my/;
use Test::More;
use Data::Dumper;

sub foo {
    ${peek_my(1)->{'$x'}} = 'yay';
}

{
    my $x;
    foo();
    is $x, 'yay';
}

{
    foo(my $x);
    is $x, 'yay';
}

done_testing;