Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Extracting records with unique ID

by mmittiga17 (Scribe)
on Sep 23, 2008 at 18:32 UTC ( [id://713277]=note: print w/replies, xml ) Need Help??


in reply to Re: Extracting records with unique ID
in thread Extracting records with unique ID

Thanks all for your responses. My biggest how to structure a hash when he key is on multiple lines. Can some one point in the correct direction on that.
  • Comment on Re^2: Extracting records with unique ID

Replies are listed 'Best First'.
Re^3: Extracting records with unique ID
by massa (Hermit) on Sep 25, 2008 at 01:17 UTC
    instead of using a hash where keys and values are strings, use a hash where the keys are strings and the values are references to arrays (so you can put more than one value for a key):
    my %h; while( <> ) { my ($k, $v) = process $_; push @{$h{$k}}, $v } for my $k ( keys %h ) { #traverse all keys for my $v ( @{$h{$K}} ) { #traverse all values for that key do_your_stuff $k, $v; } }
    and read perllol, perlreftut, perlref, perldsc... I would prefer you read them in that order, but do as you please!!!
    []s, HTH, Massa (κς,πμ,πλ)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found