in reply to Removing duplicates from list

(Not a perl answer, but still:) Pipe the output to uniq:
perl my_script.pl | uniq
Perl is a fantastic language for writing one-liners, scripts, and full-on applications, but the shell and common shell utilities are incredily useful, too.

Correction:

perl my_script.pl | sort | uniq

------------
:Wq
Not an editor command: Wq

Replies are listed 'Best First'.
Re: Re: Removing duplicates from list
by sgifford (Prior) on Oct 14, 2003 at 04:08 UTC

    uniq will only work if the items are sorted (or at least if all of the identical items are consecutive).

    $ printf "a\nb\na\n" |uniq
    a
    b
    a
    

    sort |uniq would work, though, or sort -u.