in reply to formatting help
Hope that helps.use strict; use warnings; my($file) = 'foo.txt'; my($cur_segno) = 0; open(FILE,$file); while (<FILE>) { next unless s/\"//g; # this will skip the first line and remove an +y " my(@res) = split; if ($res[2] == $cur_segno) { print "$res[0], $res[1]\n"; } else { print "end\n" if ($cur_segno); print "$res[2]\n"; print "$res[0], $res[1]\n"; $cur_segno = $res[2]; } } print "end\n"; close(FILE);
|
|---|