Daniel Falkenberg wrote: > > I have just created the hash that looks like this.... > > %users = ( > 'uucp' => '14', > 'daemon' => '2', > 'daniel' => '45', > 'test2' => '45', > 'halt' => '0', > 'test4' => '45' > ); > > $user = "test4"; > > Now here I want to see if $user exists in the hash... if it doesnt then > I want it to return an error. What would be the best way of going about > this?
if ( exists $users{ $user } ) { # the %users hash has the key $user ... } perldoc -f exists John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]