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.
I forgot that RE are greedy, thus /.{6}/ make the remainder line superfluous, thanks.
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
learning new stuff all the time, thanks again. Is unpack the more efficient (faster, or less memory requiring) way to do this?
cheers/h
