http://www.perlmonks.org?node_id=1100291

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to rename the last _ with a , but not sure how to do that.
Here is what I have so far-

my @flist = qw' 1st-device-CA_Eth.0/1 2nd-device-TX_Gig.1/1 '; print "@flist\n"; for my $file (@flist) { $file =~ s{\_[^_]+$}{, }; print "$file\n"; }
Output:
1st-device-CA_Eth.0/1 2nd-device-TX_Gig.1/1 1st-device-CA, 2nd-device-TX,

Now, how do I get the rest of the info back after that (,)? Please help.