in reply to Re^2: How to store all 1 s in perl
in thread How to store all 1 s in perl
See perlop for precedence (update: and associativity, which is the critical consideration in this case) of x (string) and / (numeric) operators.Win8 Strawberry 5.8.9.5 (32) Wed 04/07/2021 21:57:03 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my $value = 1 x 131; print 'A: ', $value; my $value1 = $value / 1; print 'B: ', $value1; ^Z A: 1111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111 1111111111111111111111111111111111 B: 1.11111111111111e+130
Update: Another way to look at it:
(Sorry about the wrap-around. :)Win8 Strawberry 5.8.9.5 (32) Wed 04/07/2021 21:58:47 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my $value = 1 x (131 / 1); print 'C: ', $value; ^Z C: 1111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111 1111111111111111111111111111111111
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to store all 1 s in perl
by Anonymous Monk on Apr 08, 2021 at 05:54 UTC |