Since the point of the loop is to look for cycles, stop as soon as you find one.
SEARCH: foreach my $item (keys %edgeHash){ foreach my $item2(@{$edgeHash{$item}}){ if($item2 eq $b){ $good = "0"; last SEARCH; # one is enough, stop now. } } }
In reply to Re: H of A optimization
by dws
in thread H of A optimization
by abitkin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |