in reply to Eliminating last comma

There's no need for the $myNames variable in the regex or the substitution string.

$my_text =~ s/,$//;

But it might be easier to just not add the last comma in the first place.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg