$ perl -Mstrict -Mwarnings -E ' my @words = ("what?", "what!", "what,"); say for map { s/[?!,]$//; $_ } @words; ' what what what