> preserve all alphabetic elements of the array but the duplicate numeric elements must be removed
but I think what you want is to parse the data pairwise ($number, $name) and have a unique list of names per number.
In this case I'd suggest building a hash of hashes (if original order doesn't matter). Just set
$names_per_num{$number}{$name} = 1
for each combination.
After that you'll just need to iterate over all numbers and print the keys of the sub-hash to get your desired output.
No code yet, we'd love to help you improving your attempts! :)
HTH!
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
PS: and if original order matters just use the above HoH as a %seen filter while iterating the list.
In reply to Re: How do I remove duplicate numeric elements of an array and preserve alphabetic elements?
by LanX
in thread How do I remove duplicate numeric elements of an array and preserve alphabetic elements?
by jzelkowsz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |