- 论坛徽章:
- 145
|
本帖最后由 jason680 于 2012-08-24 15:28 编辑
回复 5# 7looki
perldoc perlop
left + - .
option "+" and "." are the same priority
print "2+3=" . 2 +3
step 1. to connect string by "."
"2+3=2" + 3
step 2. to add number by "+"
"2+3=2" not a number and try to transfer to number and get number 2 only by "2+3=2"
do 2 + 3 and answer is number 5
step 3. to print with answer number 5 only
finally, you got the 5 only
Note: you can try perl -e 'print "2+3" . 9 +3' and you will get number 5 again.
---------------------------------
print "2+3=" , 2 +3
step 1. to print first element of list "2+3="
step 2. to print second element, 2+3, by answer number 5
finally, you got the 2+3=5
|
|