Multiple commands separated by commasby tel2 (Pilgrim)
|on Sep 01, 2011 at 05:51 UTC||Need Help??|
tel2 has asked for the
wisdom of the Perl Monks concerning the following question:
Dearly beloved Monks,
We are gathered here today to try to help me understand what kinds of commands can be strung together with commas, and what kinds can't, for concise coding.
For example, this works as I would expect (i.e. $x gets the value of $i before the "next" command occurs:
But here, I would have expected "Next" to print, but as you can see, it doesn't:
1. Why does '$x = $i' get executed, but 'print "Next"' seems not to, in the above examples?
2. Why didn't I get some kind of error/warning (still nothing even with the '-w' switch), in my 2nd example?
3. Where can I read up about which kinds of commands can be strung together with commas, and which can't?