http://qs321.pair.com?node_id=17811

visnu has asked for the wisdom of the Perl Monks concerning the following question:

is there a way to perform a regular expression search moving backwards through a string? eg, the last whitespace character?

maybe i'm asking the wrong question. i'm working on code that wraps text at say 80 columns.. the text can break at spaces and punctuation, but i have to do something like:

$i = rindex $_, ' ', $WRAP_WIDTH;
$next_line = substr $_, $i, length, "";