But if ultimate efficiency is the goal, then there is an even more efficient way to use hash lookup:
my %hash; @hash{@list} = (); # Don't bother filling in values foreach my $x (1..1000) { if (exists $hash{$x}) # Just test for existence of key { print "$x is in the list\n"; } }
In reply to Re: Re: Making a match
by TheDamian
in thread Making a match
by Baz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |