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


in reply to Regex To Remove File Extension

Just for the TIMTOWTDI, here's one using substr and rindex:

my $n = 'foo.bar.txt'; $n = substr $n, 0, rindex( $n, q{.} );

In my own code, I'd write s{ \. [^.]+ \z }{}xms