Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I think the truth table for "The ^ operator" is wrong. I think it should be:

Bit 0Bit 1Bit 0 ^ Bit 1

Also: "&&" works by evaluating the right operand, and if and only if that returns a true value the left operand is evaluated and that result is returned. "||" works similar, but only evaluates the left operand if the right operand was false.

This is incorrect. Perl always works from left to right. See:

$a = 0; $b = 0; $c = $a++ && $b++; # only $a++ is evaluated print "a = $a, b = $b\n"; # prints "a = 1, b = 0"
$a = 0; $b = 0; $c = ++$a || ++$b; # only ++$a is evaluated print "a = $a, b = $b\n"; # prints "a = 1, b = 0"
Otherwise I think this can go to Tutorials as well...


In reply to Re: Bit operations for beginners by liz
in thread Bit operations for beginners by Cine

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2022-12-01 23:26 GMT
Find Nodes?
    Voting Booth?