On Mon, Dec 29, 2003 at 09:03:27AM -0800, R. Hannes Niedner ([EMAIL PROTECTED]) wrote:
> my $string = 'string_of_40k_chars';
> my @strings = $string =~ /.{6,6}/g;
> my $remainder = substr($string, -1, length($string)%6);

You mean /.{6}/ instead of /.{6,6}/, I think.  The latter will indeed
work, though.

If you really wanna use that regex thing, use:

my $alphabet = join( "", "A".."Z" );

my @chunks = ( $alphabet =~ /.{1,6}/g );
#my @chunks = unpack( "(A6)*", $alphabet );
print join( ", ", @chunks ), "\n";

But really, that unpack() trick is the way to go.

xoa

-- 
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance

Reply via email to