Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Even the Perl people call autovivication - specifically when using exists - surprising behaviour:

exists

Near the bottom:
"This surprising autovivification in what does not at first--or even second--glance appear to be an lvalue context may be fixed in a future release."

I would not expect something that just returns true or false to modify the data that is passed to it. I know that people are going to say that it is not modifying the data passed to it - because you are actually dereferencing the hash elements in the CALL to exists() - not within exists itself. However, there must be some way to prevent it from happening when calling exists(). If any one of the lower hash keys does not exist in the hash being tested, then obviously the one you're testing for does not, and exists() should just return false.


In reply to Re^4: Why does exists cause autovivication? by Anonymous Monk
in thread Why does exists cause autovivication? by Argel

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-19 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found