in reply to Duplicate fields

... my $past=""; for my $record (sort @records){ chomp $record; if ($record !~ /^$past/{ push @uniq, $past; } $past=$record; } push @uniq, $past; ...
Ugly, messes with the values of your data, but may be what you are looking for.

Replies are listed 'Best First'.
Re^2: Duplicate fields
by mzedeler (Pilgrim) on Jul 28, 2009 at 10:47 UTC

    Grin. Put in a single A on a line, and everything starting with that is gone. A good way to make the asker think again, but probably not the right solution.

      Not so much, it drops repeats until a change, though it sorts the contents of the file and strips the newlines, so it's almost certainly the wrong answer, definitely not scalable, and the $past isn't quoted correctly, but other than that it works perfectly ;)
      ~/$ perl tmp.pl data A different line A line similar to the previous one Apples are tasty this is a line which contains the previous line in it's entirety this is not the same ~/$ cat data A A line similar to the previous one A different line Apples are tasty this is a line this is a line which contains the previous line this is not the same this is a line which contains the previous line in it's entirety