in reply to H of A optimization
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. } } }
|
|---|