Philipp Traeder wrote:
I don't know what an expert would say,

Neither do I. :)

but for testing if a hash contains an element, I normally use
"exists":

Your wording "if a hash contains an element" is ambigous IMO. A hash or associative array consists of key/value pairs, where the keys are indexes and the values are considered to be the elements (I think).

  if (exists ($hash{'mykey'})) {
        print 'mykey exists.';
  }

That's fine, as long as you are aware that $hash{mykey} may well be undefined even if it "exists".

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to