$a = "flies tries babies deadliest priest fiesta";

$a =~ s/ies\b/y/g; # make sure that ies is at the end of a word with \b

print $a;
