[Israel.pm] Direct access to variables from sub

Ephraim Dan E.Dan at F5.com
Sun Oct 2 05:27:44 PDT 2005

> david istermann writes:
> I have a subroutine which returns a hash (a real hash, not a
> reference). I'd like to directly access an entry inside this hash
> bypassing variable assignment, however I cannot seem to successfully
> tell Perl my intention... Please help!

sub hash_sub {
    return ( foo => 42, bar => 'zippy' );

my %test = hash_sub();
$test{ foo } ++;
print "$test{ foo }\n";



More information about the Perl mailing list