On Wed, 9 Mar 2022 at 16:16, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote: > > demerphq <demerphq@gmail.com> writes: > > > Perl defines that "7" and 7 are both equivalent in almost every > > regard, the few places they might not be the dev is expected to > > disambiguate, eg logical operators like ^ | & care, nothing else in > > These are bitwise operators, not logical, and are an anomalous exception > to the usual rule in perl that the operator decides what to treat the > operand as. Yes sorry, brain slip. > > perl does, and in those cases the dev should be specifying which > > behavior they want by doing 0+$x | 0+$y or "$x" | "$y". Because to > > perl both "are" the number seven and both "are" the string "7". > > To remedy this anomaly, the 'bitwise' feature was introduced in 5.22 and > and added the :5.28 and later feature bundles. It makes the plain > bitwise operators consistently treat their arguments as integers, and > adds dotted variants (&. |. ^. ~.) that treat the arguments as strings. > > https://metacpan.org/pod/feature#The-'bitwise'-feature Thanks I had forgotten about that. But it reinforces my point, in almost no situation should any perl code by serialization care if something was "created_as_number" or not. I am starting to think that calling it serialize_as_number would be better. cheers, Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next