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


in reply to how to Check file type?

Another way to grab the extension is to put the split name in an array and pop the last element.
#!/usr/bin/perl -w my $filename = "this.is.my.filename.txt"; my @bits = split /\./, $filename; print pop @bits;