Don't ask to ask, just ask | |
PerlMonks |
Re: A Perl aptitude testby ferrency (Deacon) |
on May 02, 2003 at 17:59 UTC ( [id://255106]=note: print w/replies, xml ) | Need Help?? |
You actually get a "6" followed by a "4".
The inner print(2 * 3) is evaluated first: it prints 6, and returns the value "1" because the print succeeded. 1 + 3 is 4, so the outer print prints 4. There were no delimiters between the two digits, so they look like one number instead of two sequential digits. This brings up the original trick question quite nicely: the parentheses on print (2 * 3) + 3 make print() look like a function call, they aren't simply an arithmetic grouping operator in this case. Alan
In Section
Meditations
|
|