Jenda Krynicky wrote:
From: "John W. Krahn" <[EMAIL PROTECTED]>
Rob Dixon wrote:
obdulio santana wrote:
May be this helps
perl -lne "print if ++$D{$_} == 1" address.txt
You may prefer the cuteness of
perl -lne "print unless $D{$_}++" address.txt
Or the shortness of:
perl -ne'$D{$_}++||print' address.txt
Actually this
perl -n'${$_}||=print'
works as well as long as the last line in the file either does end
with a newline or doesn't match any builtin variable whose default
value is already true.
One more keystroke down.
$ perl -c -n'$D{$_}++||print'
Unrecognized switch: -$D{$_}++||print (-h will show valid options).
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/