in reply to Extracting records with unique ID

I really can't follow the logic of your program: it seems you are reading the file and, for each line read, parse all the lines read so far to check for ID equality. It is certainly not the fastest way to do it.

If I understand the problem, you want to group data from lines with the same ID and then print it in some format. What I'd do is to:

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Replies are listed 'Best First'.
Re^2: Extracting records with unique ID
by mmittiga17 (Scribe) on Sep 23, 2008 at 18:32 UTC
    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.
      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 (κς,πμ,πλ)