Yes. This is most probably right.

Note that you can check that with two possibly syntax:

print "value undefined" unless defined $hash_plp_lbl_barrel_region_onl +y{$s};
or
print "key does not exist in hash" unless exists $hash_plp_lbl_barrel_ +region_only{$s};
The difference between the two syntaxes is a bit subtle, but not so complicated.

The variable $hash{foo} may have several status.

If the element for key "foo" does not exist at all in the hash, both defined and exists will report a false value.

If the element for key "foo" exists, but the value for that element is not defined, then exists will return a true value, and defined will report false.

I hope this is clear, as I said this is somewhat subtle, but it is important in some cases to understand the difference.

Having said that, it is often not so important, the difference is in many case inexistent, it really depends on how you hash was built in the first place (and how you maintain it).

Well, I hope my explanations are clear, if they are not, please ask, may be an example might be clearer.


In reply to Re^5: Is this a severe error? by Laurent_R
in thread Is this a severe error? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.