in reply to rearranging a string.new
The other responses in this thread are addressing your problem directly, but I wanted to point out an alternative.
In general, fixed-length string decomposition is easiest with unpack (and if necessary, its companion pack). Your particular example can be accomplished with:
Golf anyone? :-)my $newstring = join '' => reverse unpack('a4 a4', $string);
|
|---|