in reply to searching backwards in a string

You can take advantage of greediness, in this case: $string =~ /(.*)\s(\S*?)/; That'll match greedily before the white space and minimally after it. I agree with plaid, though. Use a CPAN module for wrapping.