in reply to regex to rename last _ with ,
$file = reverse $file; $file =~ s/_/,/; $file = reverse $file;
To get back what's after the inserted comma, the following should work:
$file =~ s/_([^_]*)/,$1/; my $rest = $1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex to rename last _ with ,
by ArifS (Beadle) on Sep 11, 2014 at 14:00 UTC |