in reply to Re^2: to avoid redundacy in a file
in thread to avoid redundacy in a file
You can do it in one shot, so you might as well.That makes your second snippet
:^)my $prev; while (<>) { next if ($_ eq $prev); print $prev = $_; }
Hmm..my $prev; while (<>) { print $prev = $_ unless $_ eq $prev; }
Err.. sorry, got carried away for a second.. Perl is just too seductive. Sigh. :-)my $prev; $_ ne $prev and print $prev = $_ while <>;
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: to avoid redundacy in a file
by tadman (Prior) on Jul 15, 2002 at 19:06 UTC |