Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: creating unique list from elements in an array

by Hofmator (Curate)
on Aug 17, 2001 at 13:44 UTC ( #105642=note: print w/replies, xml ) Need Help??


in reply to Re: creating unique list from elements in an array
in thread creating unique list from elements in an array

Very nice, mirod++, a good explanation! I just add the compact version - which is also a bit more efficient because it uses a hash slice:

my %unique; @unique{ split /,\s*/, ( split /\|/ )[2] } = () while (<DATA>); my @unique_names = keys %unique; print join "-", @unique_names; print "\n"; __DATA__ value 1|value 2|tom, chris, dave|value 4 value 1|value 2|peter, tom, dave|value 4

-- Hofmator

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2023-01-31 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?