Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: to select unique characters

by jwkrahn (Monsignor)
on Feb 13, 2008 at 08:03 UTC ( #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
Node Status?
node history
Node Type: note [id://667741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2021-03-04 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (108 votes). Check out past polls.

    Notices?