develooper Front page | perl.perl5.porters | Postings from July 2009

Re: [perl #63574] funny results from ~ on non-Latin-1 string

Thread Next
From:
Yitzchak Scott-Thoennes
Date:
July 16, 2009 20:49
Subject:
Re: [perl #63574] funny results from ~ on non-Latin-1 string
Message ID:
53146.97.113.117.246.1247802540.squirrel@webmail.efn.org
Zefram wrote:
> ~ is documented to operate on integers or bit strings, but "\x{aaa}"
> is neither.  Empirically, if ~ is applied to a string containing at least
> one non-octet, the result is a string of the same length, where each
> codepoint is equal to 0xffffffff minus an input codepoint.  That could
> conceivably be a useful operation, if it could be consistently applied
> to all strings, but if all input codepoints are 0xff or below then ~
> negates octets rather than 32-bit codepoints.  ~~$_ eq $_ is broken for
> values such as "\x{ffffffaa}".

Not a bug.

The existing behavior was Jarkko's call during 5.7.x development, though it
seems to have escaped being documented.

See http://www.nntp.perl.org/group/perl.perl5.porters/2000/11/msg25864.html



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About