in reply to Re: How to split a string into chunks of length n or less
in thread How to split a string into chunks of length n or less
Well:
would avoid sticking a space on the end of a string which was originally an exact multiple of 16 characters.$str =~ s/(.{16})(?!\Z)/$1 /g ;
would split any "words" longer than 16 characters.$str =~ s/(\w{16}(?=\w)/$1 /g ;
|
|---|