diff options
author | Father Chrysostomos <sprout@cpan.org> | 2017-12-31 12:54:44 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2017-12-31 16:22:51 -0800 |
commit | 193789ac15b87b3f3a23dc38e9e19500c69dbf28 (patch) | |
tree | b37ec2ab1c9897cf70558165b8564ff206e6b114 /pod/perlop.pod | |
parent | 401d2aaa50f74cc9e0d089bb6236d5960689c76c (diff) | |
download | perl-193789ac15b87b3f3a23dc38e9e19500c69dbf28.tar.gz |
Update docs wrt bitwise ops
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index 023353c12c..ceeb97fc47 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -266,12 +266,13 @@ X<~> X<negation, binary> Starting in Perl 5.28, it is a fatal error to try to complement a string containing a character with an ordinal value above 255. -If the experimental "bitwise" feature is enabled via S<C<use feature -'bitwise'>>, then unary C<"~"> always treats its argument as a number, and an +If the "bitwise" feature is enabled via S<C<use +feature 'bitwise'>> or C<use v5.28>, then unary +C<"~"> always treats its argument as a number, and an alternate form of the operator, C<"~.">, always treats its argument as a string. So C<~0> and C<~"0"> will both give 2**32-1 on 32-bit platforms, -whereas C<~.0> and C<~."0"> will both yield C<"\xff">. This feature -produces a warning unless you use S<C<no warnings 'experimental::bitwise'>>. +whereas C<~.0> and C<~."0"> will both yield C<"\xff">. Until Perl 5.28, +this feature produced a warning in the C<"experimental::bitwise"> category. Unary C<"+"> has no effect whatsoever, even on strings. It is useful syntactically for separating a function name from a parenthesized expression @@ -872,10 +873,10 @@ the parentheses are essential in a test like print "Even\n" if ($x & 1) == 0; -If the experimental "bitwise" feature is enabled via S<C<use feature -'bitwise'>>, then this operator always treats its operand as numbers. This -feature produces a warning unless you also use C<S<no warnings -'experimental::bitwise'>>. +If the "bitwise" feature is enabled via S<C<use feature 'bitwise'>> or +C<use v5.28>, then this operator always treats its operands as numbers. +Before Perl 5.28 this feature produced a warning in the +C<"experimental::bitwise"> category. =head2 Bitwise Or and Exclusive Or X<operator, bitwise, or> X<bitwise or> X<|> X<operator, bitwise, xor> @@ -895,10 +896,10 @@ for example the parentheses are essential in a test like print "false\n" if (8 | 2) != 10; -If the experimental "bitwise" feature is enabled via S<C<use feature -'bitwise'>>, then this operator always treats its operand as numbers. This -feature produces a warning unless you also use S<C<no warnings -'experimental::bitwise'>>. +If the "bitwise" feature is enabled via S<C<use feature 'bitwise'>> or +C<use v5.28>, then this operator always treats its operands as numbers. +Before Perl 5.28. this feature produced a warning in the +C<"experimental::bitwise"> category. =head2 C-style Logical And X<&&> X<logical and> X<operator, logical, and> @@ -1233,7 +1234,7 @@ the number of elements produced by the expression on the right hand side of the assignment. The three dotted bitwise assignment operators (C<&.=> C<|.=> C<^.=>) are new in -Perl 5.22 and experimental. See L</Bitwise String Operators>. +Perl 5.22. See L</Bitwise String Operators>. =head2 Comma Operator X<comma> X<operator, comma> X<,> @@ -3376,16 +3377,15 @@ operation you intend by using C<""> or C<0+>, as in the examples below. $baz = 0+$foo & 0+$bar; # both ops explicitly numeric $biz = "$foo" ^ "$bar"; # both ops explicitly stringy -This somewhat unpredictable behavior can be avoided with the experimental -"bitwise" feature, new in Perl 5.22. You can enable it via S<C<use feature -'bitwise'>>. By default, it will warn unless the C<"experimental::bitwise"> -warnings category has been disabled. (S<C<use experimental 'bitwise'>> will -enable the feature and disable the warning.) Under this feature, the four +This somewhat unpredictable behavior can be avoided with the "bitwise" +feature, new in Perl 5.22. You can enable it via S<C<use feature +'bitwise'>> or C<use v5.28>. Before Perl 5.28, it used to emit a warning +in the C<"experimental::bitwise"> category. Under this feature, the four standard bitwise operators (C<~ | & ^>) are always numeric. Adding a dot after each operator (C<~. |. &. ^.>) forces it to treat its operands as strings: - use experimental "bitwise"; + use feature "bitwise"; $foo = 150 | 105; # yields 255 (0x96 | 0x69 is 0xFF) $foo = '150' | 105; # yields 255 $foo = 150 | '105'; # yields 255 |