Here's a faster way to do that (looks neat too):foreach (@animals) { $animals{$_}++; } # initialize %animals hash
It's not exactly the same since it's setting each hash member to 1 instead of ++'ing it, but that's no big deal if you're just checking for an element's existance.@animals{@animals} = (1) x @animals;
-Matt
In reply to RE: Re: better way to find list members?
by DrManhattan
in thread better way to find list members?
by jptxs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |