in reply to Re^2: How to split a string based on length or word boundary
in thread How to split a string based on length or word boundary
As Athanasius pointed out above, you need to change that to:
print "| $_ |\n" for map substr( $_ . ' 'x$menuWidth, 0, $menuWidth ), + $text =~ m[(.{1,$menuWidth})(?:\s+|$)]g; #..................................................................... +.............................^^^^^^^^^
|
|---|