
japhy
Enthusiast
Apr 6, 2001, 10:17 AM
Post #2 of 4
(276 views)
|
Larry Wall is quoted in saying (and this appeared on the right-hand side of this web site, in the "Wit from the Wall" section): "Doing linear scans over a hash is like clubbing someone to death with an uzi." If you want to see if a particular key in a hash has a particular value, just do:
if ($hash{$key} eq $value) { ... } That reduces your code to:
if ($masterhash{$user} eq $pass) { ... } else { ... } Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author
|