From: Gurusamy Sarathy Date: Fri, 3 Dec 1999 06:46:16 +0000 (+0000) Subject: document incompatible perl4 vec() vs bitwise ops interaction trap X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=651ad3b17ab67895472664d06caa48dedb1f20bf;p=p5sagit%2Fp5-mst-13.2.git document incompatible perl4 vec() vs bitwise ops interaction trap (from Tom Phoenix) p4raw-id: //depot/perl@4630 --- diff --git a/pod/perltrap.pod b/pod/perltrap.pod index 50987cb..4920f53 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 function. perl5 treats the string operands as bitstrings. +(See L 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