# perl4 prints: a is foo bar, b is baz
# perl5 errors: Bare word found where operator expected
-
+
=item * Discontinuance
The archaic while/if BLOCK BLOCK syntax is no longer supported.
happens when you use C<$_> for the loop variable, and call subroutines in
the loop that don't properly localize C<$_>.)
+=item * Discontinuance
+
+C<split> with no arguments now behaves like C<split ' '> (which doesn't
+return an initial null field if $_ starts with whitespace), it used to
+behave like C<split /\s+/> (which does).
+
+ $_ = ' hi mom';
+ print join(':', split);
+
+ # perl4 prints: :hi:mom
+ # perl5 prints: hi:mom
+
=item * Deprecation
Some error messages will be different.
=item * Numerical
-Large integer trap with autoincrement
+This specific item has been deleted. It demonstrated how the autoincrement
+operator would not catch when a number went over the signed int limit. Fixed
+in 5.003_04. But always be wary when using large ints. If in doubt:
- $a = $b = 2147483647;
- print "$a $b\n";
- $a += 1;
- $b++;
- print "$a $b\n";
-
- # perl4 prints:
- 2147483647 2147483647
- 2147483648 2147483648
-
- # perl5 prints:
- 2147483647 2147483647
- 2147483648 -2147483648
+ use Math::BigInt;
=item * Numerical
# perl4 prints: 1 2 4
# perl5 prints: Literal @fred now requires backslash
-
+
=item * (Scalar String)
Changes in unary negation (of strings)
# perl4 errors: There is no caller
# perl5 prints: Got a 0
-
+
=item * (scalar context)
The comma operator in a scalar context is now guaranteed to give a
=over 5
-=item *
+=item * Precedence
+
+LHS vs. RHS when both sides are getting an op.
+
+ @arr = ( 'left', 'right' );
+ $a{shift @arr} = shift @arr;
+ print join( ' ', keys %a );
+
+ # perl4 prints: left
+ # perl5 prints: right
+
+=item * Precedence
These are now semantic errors because of precedence:
# perl 4 prints: -:a
# perl 5 prints: x
-
+
=item * Precedence
concatenation precedence over filetest operator?
# perl4 prints: yup yup yup yup abc
# perl5 prints: abc
+=item * warn() specifically implies STDERR
+
+ warn STDERR "Foo!";
+
+ # perl4 prints: Foo!
+ # perl5 prints: String found where operator expected
+
=back
=head2 OS Traps