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


in reply to Re: Extracting just the extension from a filename.
in thread Extracting just the extension from a filename.

This would work OK, but if the extension would contain some `funny' characters you could get into problem. It is not very often that you get extensions with spaces and other weird things, but hey, you never know. So my solution would be:

my $filename = '20020719.csv'; $filename =~ /\.([^\.]*)$/; my $extension = $1;