in reply to Drop middle part in a substitution
TMTOWTDI. Here's a non-regex solution:
my $name = 'filename.dqhfhqlkGif'; substr $name, (index $name, '.') + 1, -3, ''; print $name;
In fact if you change index to rindex, it'll work even if there's more than one period in the name.
dave
Update: Also works with filenames containing newlines.
|
|---|