in reply to Keeping the first occurence of a pattern, and removing the other occurences
my %seen; while (<DATA>) { %seen = () if (/^\s*STORE/); #start over for each STORE #just /\f/ might be fine too next if $seen{$_}; $seen{$_}++ if /^DEPT/; #no more DEPT lines print; }
|
---|