Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

OK LanX,Eily,roboticus, thanks I understand it now: The hash contents are a single statement (re: the comma) which is parsed and its elements are pushed into a stack. But $m is a reference so although its value is updated correctly, the reference pushed in the stack is always the same. So it's only the last value which will prevail. Same with ++$m. But not for $m++ which, I guess, it has to create a temporary variable to store its effect and that is what's pushed into the stack. Which is also the trick used by LanX.

perlfan A reason I use the sequence of exists and defined is to avoid autovivification, which will appear when I use deeper levels. I know I can turn it off... (btw that's not a "sane" default!!!)

Question: the if-statement is safe as (I guess) it evaluates each sub-conditional to a true-false and does not stack the variables? e.g. if( exists($h->{1}) && defined($m=$h->{1}) && ($m==1) && defined($m=$h->{2}) && ($m==2) ){ ... }


In reply to Re: Ternary Quizical behaviour? by bliako
in thread Ternary Quizical behaviour? by bliako

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 learning in the Monastery: (7)
As of 2024-03-28 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found