in reply to logic behind the print function
You should have turned on warnings, especially when things didn't work as you expected them to.
$ perl -wle'print(print (5+2)+10)' print (...) interpreted as function at -e line 1. 7 11
That message means the space between print and the paren isn't significant.
print(5+2) prints 7 and returns a true value (which happens to be 1) on success.
print(1+10) prints 11.
Maybe you want
print( (5+2)+10 )
Omitting parens around the args of Perl function calls is perilous.
|
|---|