in reply to Parsing problem

Here's a little hack that might get you on track. I had to read the input twice so that I can process it. I'm sure there is better way to do this.
#!/usr/bin/perl use strict; my $data_pos = tell DATA; my %record_of; while (my $line = <DATA>) { chomp( $line ); my ($key, $val) = (split /\s+/, $line)[3,4]; $record_of{$key}++; } seek DATA, $data_pos, 0; while (my $line = <DATA>) { chomp( $line ); my ($key, $val) = (split /\s+/, $line)[3,4]; print "$line one\n" if ( $record_of{$key} == 1 ); print "$line end\n" if ( $record_of{$key} == 0 ); if ( $record_of{$key} == 2 ) { $record_of{$key} = 0; print "$line start\n"; next; } } __DATA__ 1 2 - perlmonks1 sdweq23 3 4 - javaforums2 sd341 5 6 - dreamtech3 fr4frf34 7 8 + dreamtech3 dcvdf3443 9 10 + sunforum4 sdcds3443 11 12 - sunforum4 ddfvdv333