in reply to Listing Keys in a specific element(s) in an array of hashs

I guess you want to traverse the array, and then traverse each hash elements. One solution could be:

for my $hash (@data) { for (keys %$hash) { ... }

If you simply want to list the keys of a hash, you can do:

my @keys = keys %{$data[0]}; # or [1], or [2], ...

Hope this helps.

Replies are listed 'Best First'.
Re^2: Listing Keys in a specific element(s) in an array of hashs
by Smylers (Pilgrim) on Jun 20, 2005 at 14:19 UTC
    I guess you want to traverse the array, and then traverse each hash elements.

    Depending on what the data's being used for, for quickly printing any complex data structure you can often avoid writing any loops yourself just by using YAML (or Data::Dumper if you prefer):

    use YAML qw<Dump>; print Dump \@data;

    Smylers