in reply to How to split_and_pad string to n-th chars pieces with one regular expression?

many thanks, it is solved,
If combine BrowserUk's and mwah's solutions, then it works fine
$x=~s/(.{1,3}|^$)\n?/sprintf"'%-3s'\n",$1/eg;
it works even on multiline strings
---
and even multiline with emptyline mixed together
$x=~s/(.{1,3}|^$)\n?/sprintf"'%-3s'\n",$1/meg;