Date: Mon, 11 Jun 2001 13:03:32 +0300 From: Peter Pentchev <roam@orbitel.bg> To: reichert@numachi.com Cc: perlbug@perl.com, hackers@FreeBSD.org Subject: Re: oct() doesn't handle binary strings Message-ID: <20010611130332.B564@ringworld.oblivion.bg> In-Reply-To: <20010609201248.58417.qmail@natto.numachi.com>; from reichert@natto.numachi.com on Sat, Jun 09, 2001 at 08:12:48PM -0000 References: <20010609201248.58417.qmail@natto.numachi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 09, 2001 at 08:12:48PM -0000, reichert@natto.numachi.com wrote: > > This is a bug report for perl from reichert@numachi.com, > generated with the help of perlbug 1.26 running under perl 5.00503. > > > ----------------------------------------------------------------- > [Please enter your report here] > > From perlfunc(1): > > oct EXPR ... > (If EXPR happens to start off with 0x, interprets > it as a hex string. If EXPR starts off with 0b, > it is interpreted as a binary string.) > > But the binary string conversion doesn't seem to work: > > natto% perl -e 'print oct("0b11000110")."\n"' > 0 > > This is otherwise a valid binary string: > > natto% perl -e 'print unpack('C', (pack("B8", "11000110")))."\n"' > 198 > > The hex string conversion function does work: > > natto% perl -e 'print oct("0xC6")."\n"' > 198 The following comments pertain to the version of Perl used in FreeBSD, since this was cited as a FreeBSD 4.0 problem. This is still true for Perl 5.005_03 in -stable, but it seems to have been fixed in Perl 5.6.0 in -current. I believe this will be fixed when Perl 5.6 is MFC'd (btw, FreeBSD developers, FreeBSD Perl gurus, when/if shall Perl 5.6 be MFC'd? :) Thus, I believe this is not (anymore) a Perl problem per se, since it is fixed in the newer versions. G'luck, Peter -- If I had finished this sentence, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010611130332.B564>