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;
In reply to Re: Re: Extracting just the extension from a filename.
by moxliukas
in thread Extracting just the extension from a filename.
by brentheigold
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |