[Israel.pm] Direct access to variables from sub
Gaal Yahas
gaal at forum2.org
Sun Oct 2 06:22:20 PDT 2005
On Sun, Oct 02, 2005 at 02:54:42PM +0200, david istermann wrote:
> 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.
keys wants a hash, not a list. You need to use the anonymous
hashref+deref trick again:
keys %{ { hash_sub() } };
--
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
More information about the Perl
mailing list