push @words, map { lc } # change to lower case map { tr/'//d; $_ } # remove apostrophes split /[\s.,?!"]+/, # split on space and punctuation $line;