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.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Eliminating last comma
by davorg
in thread Eliminating last comma
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |