in reply to Removing repeated words

while (<stdin>){ print map((s/$/ / && $_), grep(!$a{$_}++, split m/\s+/,$_)); print "\n"; }
Update: Fri Sep 20 10:25:01 2002
Whoops, forgot the \s+.. And switch the regex delims by request.

Replies are listed 'Best First'.
•Re: Re: Removing repeated words
by merlyn (Sage) on Sep 20, 2002 at 14:47 UTC
    <stdin>
    Uh, it's STDIN not stdin. The lowercase version works only for backward compatibility, and only because you happened to be in package main. The uppercase version is much preferred, and works in all packages.

    -- Randal L. Schwartz, Perl hacker