Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Parsing complex data

by sh1tn (Priest)
on Jul 15, 2005 at 15:56 UTC ( #475266=note: print w/replies, xml ) Need Help??


in reply to Parsing complex data

my @data = [ mykey1 => {firstkey => 'firstvalue', secondkey => 'secondval' }, mykey2 => {ninza => 'turtle', 'Hurricane' => 'Dennis'}, mykey3 => [ [one,two, three] ], mykey4 => [ [4, 5, three], [6, 7, four], [8, 9, five] ], ]; for( @{$data[0]} ){ ref or print "$_ => " and next; ref eq 'SCALAR' and print $$_ and next; ref eq 'HASH' and print join( ',', values %$_ ), $/; ref eq 'ARRAY' and do { for( @{$_} ){ print join( ',', split( '\s', "@$_ " )) } print $/ }; }


Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2023-02-05 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (33 votes). Check out past polls.

    Notices?