[Israel.pm] Direct access to variables from sub
david istermann
interdist at gmail.com
Sun Oct 2 05:54:42 PDT 2005
Thank you for the replies!!
I have a snip of code like the following:
1: sub hash_sub {
2: my %var = (aa => 1, bb => 2, cc => 3);
3: return %var;
4: }
5:
6: my $person2 = {hash_sub()}->{bb};
7: print "$person2 \n";
8: print +{hash_sub()}->{bb};
9: print keys %{hash_sub()};
Line 6 is now working thanks to Mikhael, and line 8 works with the
help of Yosef.
However, I cannot get the last line to print - of course, hash_sub()
returns a HASH, not \HASH, on the other hand 'keys' wants a real hash
and
keys hash_sub() ;
does not even compile.
David.
More information about the Perl
mailing list