Recent changes to unpack (added in 5.8.0) have made splitting a string into groups much easier.
$string = "foo" x 3 . "fo"; print join(" -- ", unpack "(A3)*", $string), "\n";
Though your code is slightly different; the final "fo" is tacked onto the end of the last element, whereas with the above it's a new element.
In reply to Re: Re: Process string as Array
by Somni
in thread Process string as Array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |