#!/usr/bin/perl -w my $filename = "this.is.my.filename.txt"; my @bits = split /\./, $filename; print pop @bits;