On Wed, Nov 16, 2011 at 07:49:14PM +0100, Olof Johansson wrote:
> On 2011-11-16 11:57 -0500, Ronald J Kimball wrote:
> > No, you are wrong.  s/0*// is sufficient, because /0*/ will always match at
> > the start of the string anyway.
> 
> You're clearly an expert. I yield. Can you open a bug report with perl
> and getting this fixed?

It's working as expected for me, so I'm not sure what needs to be fixed.

% cat tmp.pl
#!perl -l
print"$_: ",($_=unpack"B*",pack"N",$_)=~s/0*//?$_:$_ for@_=@ARGV;
print"$_: ",($_=unpack"B*",pack"N",$_)=~s/^0*//?$_:$_ for@_=@ARGV;
% perl tmp.pl 2147483648 3000000000
2147483648: 10000000000000000000000000000000
3000000000: 10110010110100000101111000000000
2147483648: 10000000000000000000000000000000
3000000000: 10110010110100000101111000000000
%

Are you seeing different behavior?

Ronald

Reply via email to