diff options
Diffstat (limited to 'pod/perltrap.pod')
-rw-r--r-- | pod/perltrap.pod | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/pod/perltrap.pod b/pod/perltrap.pod index fa68a753c2..cfe964270c 100644 --- a/pod/perltrap.pod +++ b/pod/perltrap.pod @@ -191,7 +191,8 @@ in Perl 5 is the backslash, which creates a reference. =item * -C<ARGV> must be capitalized. +C<ARGV> must be capitalized. C<$ARGV[0]> is C's C<argv[1]>, and C<argv[0]> +ends up in C<$0>. =item * @@ -381,6 +382,28 @@ Because if that were to work, then this couldn't: =item * +The precedence of assignment operators is now the same as the precedence +of assignment. Perl 4 mistakenly gave them the precedence of the associated +operator. So you now must parenthesize them in expressions like + + /foo/ ? ($a += 2) : ($a -= 2); + +Otherwise + + /foo/ ? $a += 2 : $a -= 2; + +would be erroneously parsed as + + (/foo/ ? $a += 2 : $a) -= 2; + +On the other hand, + + $a += /foo/ ? 1 : 2; + +now works as a C programmer would expect. + +=item * + C<open FOO || die> is now incorrect. You need parens around the filehandle. While temporarily supported, using such a construct will generate a non-fatal (but non-suppressible) warning. |