... print is only printing what is in the parens because it is treating that part like the complete input to a function ...
Deparsing with full parenthesization (see O, B::Deparse) shows this clearly. (Note, in addition to "print (...) interpreted as function...", the warning about the return value of print being raised to an exponent and then thrown away!)
c:\@Work\Perl\monks>perl -wMstrict -MO=Deparse,-p -le "my $i = 5; print (1-1/2000)**$i; print '' . (1-1/2000)**$i; " print (...) interpreted as function at -e line 1. Useless use of exponentiation (**) in void context at -e line 1. BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use strict 'refs'; (my $i = 5); (print(0.9995) ** $i); print(('' . (0.9995 ** $i))); -e syntax OK c:\@Work\Perl\monks>perl -wMstrict -le "my $i = 5; print (1-1/2000)**$i; print '' . (1-1/2000)**$i; " print (...) interpreted as function at -e line 1. Useless use of exponentiation (**) in void context at -e line 1. 0.9995 0.997502498750313
Give a man a fish: <%-(-(-(-<
In reply to Re^2: strange arithmetic
by AnomalousMonk
in thread strange arithmetic
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |