Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Removing repeated words

by abitkin (Monk)
on Sep 20, 2002 at 14:28 UTC ( #199483=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://199483]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2020-05-30 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (172 votes). Check out past polls.

    Notices?