Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: to select unique characters

by jwkrahn (Abbot)
on Feb 13, 2008 at 08:03 UTC ( [id://667741]=note: print w/replies, xml ) Need Help??


in reply to to select unique characters

That is usually written like this:

my %seen; my @uniq = grep !$seen{$_}++, @proc_name1;

And if you want to localize the scope of the hash you could do it like this:

my @uniq = do { my %seen; grep !$seen{$_}++, @proc_name1; };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2024-03-28 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found