As a guess, try this:
use strict;
use warnings;
use 5.10.0;
use Text::Wrap qw(wrap);
$Text::Wrap::columns = 30;
my $text =<<'END';
this splits exactly at 30 chars, whether or not it is in the middle of
+ the string
I would like to split at 30 or the nearest word boundary
Is this possible or do I need to do some voodoo on split?
END
say wrap('', '', $text); # first arg is indendation of first line
# second arg is indendation of subsequent lin
+es
# third arg of course the text
__END__
Prints:
this splits exactly at 30
chars, whether or not it is
in the middle of the string
I would like to split at 30
or the nearest word boundary
Is this possible or do I need
to do some voodoo on split?