Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Parsing data into an Array of Hashes

by jonadab (Parson)
on Sep 18, 2003 at 13:04 UTC ( #292376=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @stuff;
    while (<FILEHANDLE>) {
      chomp;
      push @stuff, { map {split /\s*=\s*/} split /,\s*/ }
    }
    
  2. or download this
    my @stuff;
    while (<FILEHANDLE>) {
    ...
      my %record = map {split /\s*=\s*/} split /,\s*/;
      push @stuff, \%record;
    }
    
  3. or download this
    my @stuff;
    while (<FILEHANDLE>) {
    ...
      my %record = @keysandvalues;
      push @stuff, \%record;
    }
    
  4. or download this
    $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
    split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2014-07-31 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (242 votes), past polls