... 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
In reply to Re^2: Removing duplicate lines from a file
by johngg
in thread Removing duplicate lines from a file
by green_lakers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |