Hi Shawn

I'll stick my neck out and say that this is a bug in Perl, to do with
Unicode support. Running the loop from 0..256 gives you 256 8-bit characters
and one 16-bit character (0x0100 = 256). This seems to upset split() as it
stands. Try adding:

    use bytes;

at the start of your code, and all will be well. The chr(256) will be
constrained to eight bits and add a NUL character instead of a multibyte
one.

Could someone in the know tell us more about this please? I knew something
of the sort had been reported for 5.8.0, but it's caused me problems on
5.6.1.

Cheers,

Rob


"Shawn B" <[EMAIL PROTECTED]> wrote in message
04a501c2ae9a$4f91b160$0100a8c0@nam">news:04a501c2ae9a$4f91b160$0100a8c0@nam...
> Hello all,
>   Can anyone explain why this fails?  I have done a google search for
'Split loop at', and turned up nothing.  If the initial array
> stays under 256, all is fine, but anything beyond 255 (as far as I have
tested) dies.  Is this something to do with bit size?
>
> %perl -e 'for(0..256) { $s.=chr($_) } for(split(//,$s)) { print }'
> Split loop at -e line 1.
>
> TIA,
> Shawn
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to