in reply to Re: Removing duplicate lines from a file
in thread Removing duplicate lines from a file
... Also you can writeunless ($prev eq $line){ push (@filtered,$prev); }
I would go a little further by using a statement modifier and I'd also omit the brackets around the push arguments. That saves typing two pairs of brackets and a pair of braces and, to my eye, looks clearer; others may disagree.
push @filtered, $prev unless $prev eq $line;
Cheers,
JohnGG
|
|---|