summaryrefslogtreecommitdiff
path: root/pod/perltrap.pod
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-03 06:46:16 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-03 06:46:16 +0000
commit651ad3b17ab67895472664d06caa48dedb1f20bf (patch)
treeed17415cbac8b9c2025ba7533df211ac07790038 /pod/perltrap.pod
parent33c2a72871842138b67f364dece5097eece0c0df (diff)
downloadperl-651ad3b17ab67895472664d06caa48dedb1f20bf.tar.gz
document incompatible perl4 vec() vs bitwise ops interaction trap
(from Tom Phoenix) p4raw-id: //depot/perl@4630
Diffstat (limited to 'pod/perltrap.pod')
-rw-r--r--pod/perltrap.pod24
1 files changed, 24 insertions, 0 deletions
diff --git a/pod/perltrap.pod b/pod/perltrap.pod
index 50987cb102..4920f538c3 100644
--- a/pod/perltrap.pod
+++ b/pod/perltrap.pod
@@ -715,6 +715,30 @@ Logical tests now return an null, instead of 0
Also see L<"General Regular Expression Traps using s///, etc.">
for another example of this new feature...
+=item * Bitwise string ops
+
+When bitwise operators which can operate upon either numbers or
+strings (C<& | ^ ~>) are given only strings as arguments, perl4 would
+treat the operands as bitstrings so long as the program contained a call
+to the C<vec()> function. perl5 treats the string operands as bitstrings.
+(See L<perlop/Bitwise String Operators> for more details.)
+
+ $fred = "10";
+ $barney = "12";
+ $betty = $fred & $barney;
+ print "$betty\n";
+ # Uncomment the next line to change perl4's behavior
+ # ($dummy) = vec("dummy", 0, 0);
+
+ # Perl4 prints:
+ 8
+
+ # Perl5 prints:
+ 10
+
+ # If vec() is used anywhere in the program, both print:
+ 10
+
=back
=head2 General data type traps