Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

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

bobf++, well done.

There is another logical operator; I like to regard the sequence operator, scalar comma, as the unconditional logical operator. The right hand argument is evaluated regardless of the truth of the already-evaluated left, and the last evaluated value is returned. Naturally, this has more use in shoehorning several evaluations into a single expression than in pure logic. It's often useful that way in the body of modifier statements like s/foo/bar/g, print for <>;.

Used where logicals are often seen, sequence expressions can be a sort of front-loaded continue block - without introducing a scope.

my ($i, $j) = (1, 10); while ($i++, $j--, $i < $j) { print "$i\t$j\n"; } __END__ 2 9 3 8 4 7 5 6
Note that increment and value of a variable in one expression are ok with C if they are seperated by the comma operator. That seems to work in Perl, too, as is sort-of-documented.

I think that that view of the sequence operator is not the usual one, but I find it useful. If there were an ultra-low precedence version like and and or, I'd call it then.

After Compline,
Zaxo


In reply to Re: True or False? A Quick Reference Guide by Zaxo
in thread True or False? A Quick Reference Guide by bobf

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 admiring the Monastery: (8)
As of 2024-03-28 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found