Is there a regular expression in Perl to find a file's extension?
my $file = "test.exe";
# Match a dot, followed by any number of non-dots until the
# end of the line.
my ($ext) = $file =~ /(\.[^.]+)$/;
print "$ext\n";
use File::Basename
use File::Basename;
($name,$path,$suffix) = fileparse("test.exe.bat",qr"\..[^.]*$");
print $suffix;
\.[^\.]*$
This would give you everything after the last dot (including the dot itself) until the end of the string.