Two comments:
If, like me, you don't come from a comp-sci background, then precedence-awareness of operators probably only goes as far as knowing that 3*2+1 means (3*2)+1, and that if you want 3*(2+1), then you'd better damn well say so.
I think putting the addition first (to the left) in your example illustrates the concept of precedence awareness better. Like: 1+3*2 is actually 1+(3*2) and not (1+3)*2.
Second comment: A short paragraph about the C-istic awkward precedence of some operators might be helpful to beginners without a C background. $x == $y & $z means ($x == $y) & $z. Enabling warnings catches this btw.
-
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.
|