[Chicago-talk] print keys for anon hash

Andy Lester andy at petdance.com
Mon Dec 15 09:50:42 CST 2003


> my @crew = (
>         {
>                 name => 'Gilligan',
>                 hat => 'White',
>                 shirt=>'red',
>                 position=>'first mate',
>         },
> );
> 
> print keys ($crew[0]),"\n";

$crew[0] is a hash reference, not a hash.  keys() operates on a hash.
You have to say

keys %{$crew[0]}


xoa
-- 
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance



More information about the Chicago-talk mailing list