use strict; use warnings; my @files = ('blah.config', 'boo.config', 'big.config'); for my $file (@files) { print ((split /\./, $file)[-1] . "\n") ; }