in reply to Using split() to divide a string by length
Hmm, $string =~ /.{1,3}/g should even be faster than split /(?(?{pos() % 3})(?!))/, $string. I guess not as fast as unpack, though.my $string = join '', 'a'..'z'; my @fields = $string =~ /.{1,3}/g; my @fields2 = grep {$a=!$a} @fields;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using split() to divide a string by length
by Roy Johnson (Monsignor) on Apr 13, 2006 at 21:03 UTC |