$ perl -E 'say for split /[ ,.]+/, " THIS is a variable number of words, spaces and punctuation. " =~ s/^[ ,.]*//r' THIS is a variable number of words spaces and punctuation