|
|
| No such thing as a small change | |
| PerlMonks |
Re: Array name with a Variableby mr_mischief (Prior) |
| on Apr 17, 2008 at 18:04 UTC ( #681260=note: print w/ replies, xml ) | Need Help?? |
|
Don't use symbolic references. Use regular references instead. Your exact spec and your example program don't quite cooperate with one another, but this should get you closer: Update: This code is buggy so I've put it in a readmore (not trying to hide that I make mistakes, after all). See Re^3: Array name with a Variable for the corrected code. The declaration of the hashes here is in the wrong scope and they weren't getting emptied properly.
If you don't want the intersection of an array and itself, there's an easy way to do that with flow control for the loops. You might also want to look into Set::Scalar or other CPAN modules that have done much of the work for you.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||