my $myNames = 'Jones, Smith, Baker, Johnson,'; $myNames =~ s/,$//; # replace comma at the end of the string with empty string print "$myNames\n";