in reply to One regex construct to handle multiple string types

while(<DATA>) { /(.*\.)?(\S+)/; print "$2\n"; } __DATA__ 2L bar.2L bar.ber.bir. 2L bar.ber.bir.2L
works for me.

The above reads your request as "get the first substring part not containing whitespaces that follows the last dot char (if there is one) in the input string; otherwise, return the first substring part of the input string that doesn't contain whitespace".

Hope that helps.