use 5.012; my @files= qw( 1.fi 2.fo 3.fum 4.fo.tar.gz ); s!\.[^.]+$!! for @files; say $_ for @files; __END__ C:\>perl -w tmp.pl 1 2 3 4.fo.tar