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
|
|---|