If you want to test whether a certain key exists and has the value you expect, you can do thisperhaps you mean exists?
if (defined $foo{'bar'} and $foo{'bar'} eq 'baz'){ }
reminder to all: in an array or hash lookup, defined tests for definedness of the value of the array index or hash key, which may not be what you mean. use exists to test whether the array index or hash key is present.if (exists $foo{'bar'} and $foo{'bar'} eq 'baz'){ }
~Particle *accelerates*
In reply to Re: Re: Testing for key/value match
by particle
in thread Testing for key/value match
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |