in reply to How to split a string into chunks of length n or less

How about:
$str =~ s/(.{16})/$1 /g;


-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."

Replies are listed 'Best First'.
Re^2: How to split a string into chunks of length n or less
by gone2015 (Deacon) on Aug 21, 2008 at 16:38 UTC

    Well:

    $str =~ s/(.{16})(?!\Z)/$1 /g ;
    would avoid sticking a space on the end of a string which was originally an exact multiple of 16 characters.
    $str =~ s/(\w{16}(?=\w)/$1 /g ;
    would split any "words" longer than 16 characters.