in reply to Re: Process string as Array
in thread Process string as Array

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.