in reply to Re: Removing dotsin thread Removing dots
You can get your answer more quickly by firing up the debugger and just trying it out:
% perl -de 1 DB<1> $s = 'Hello.1.txt' DB<2> $s =~ s/\.(?=txt$)//g # in this case the /g is superfluous DB<3> p $s Hello.1txt [download]
the lowliest monk
If you really want to remove all but the first occurance:
$filename =~ /\./; substr($filename, $-[0]+1) =~ s/\.//g if @-; [download]