in reply to Hash search yields unexpected results
As a side note, you iterate over your hash values in checkControlMap. To quote our illustrious figurehead,
Doing linear scans over an associative array is like trying to club someone to death with a loaded Uzi.That could be written as
-- TimToady
with no change to functional behavior.sub checkControlMap { my $check = $_[0]; print "Look for control [$check] - "; my $process = $process_control{$check}; if (not defined $process) { print "WARNING [$check] was not found. - "; $process = 1; } return $process; }
Update: Actually, it does cause a change in functional behavior, as mortiz points out below. So use this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash search yields unexpected results
by moritz (Cardinal) on Feb 13, 2012 at 19:54 UTC |