Package: perl
Version: 5.8.8-7

The script below, when invoked with "perl script.pl 8" prints
"256/256", followed by "XXXXX".  When invoked as "perl script.pl 32",
I get "4294967296/4294967296", followed by ... an empty line.
Apparently, substr fails for such strings.  There are more obscure
failures related to substr, but I haven't got a test case for them.

This occurs on an amd64 machine with sufficient address space.

It's probably best to die with an error message when the creation of a
string of unsupported size is attempted.

#! /usr/bin/perl
use strict;
use warnings;

my $size = 1 << $ARGV[0];
my $data = 'X' x $size;
my $len = length($data);
print "$size/$len\n";
my $d = substr $data, $len - 5;
print "$d\n";



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to