Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Re: Union of arraysby thpfft (Chaplain) |
on Oct 26, 2002 at 12:06 UTC ( [id://208220]=note: print w/replies, xml ) | Need Help?? |
The hash slice is very neat, but you're going to lose sequence that way, which might matter. How about a nearly-one-liner:
which also skips duplicates in the existing arrays, as yours would. Btw, does the hash slice - if, indeed, that's what it is - cut out this loop altogether, or does it just conceal it? If the former then I imagine this approach is a lot less efficient. ananda: the perl cookbook deals with this kind of question very well, iirc. update: code tweak
In Section
Seekers of Perl Wisdom
|
|