Carl Friedberg wrote:
Mark, I can explain number 1 by precedence and the results from number
2, which, however I can not explain, nor understand. Here's a simpler
example of number 2:

$ perl -e "print (2)*5;"
2

Does this make it easier to see?


$ perl -we 'print print (2)*5;'
print (...) interpreted as function at -e line 1.
25

or this?

$ perl -wle 'print print (2)*5;'
print (...) interpreted as function at -e line 1.
2
5

Line the warning says, the parens makes print a function call. Then the returned value of print() (RETURN, i.e. 1) is multiplied by 5, which yields 5.

As the old joke goes, "Then don't do that!"

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747



Reply via email to