Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Extract keys from an Array of Hashes

by eff_i_g (Curate)
on Dec 16, 2010 at 18:00 UTC ( [id://877532]=note: print w/replies, xml ) Need Help??


in reply to Extract keys from an Array of Hashes

This isn't exactly what you want, but it (Data::Rmap) is new to my toolbox and quite handy if your structure becomes more mangled:
use strict; use warnings; use Data::Rmap qw(:all); my @AoH = ( {'name' => 'Barney', 'age' => '34'}, {'name' => 'Fred', 'age' => '36'}, {'name' => { first => 'John', last => 'Doe' }, age => '40' } ); rmap_hash { print join "\n" => keys %$_; print "\n"; } @AoH;
name age name age name age first last

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://877532]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-24 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found