my $file = 'Perl.TEST.exe'; my ($text,$endung)=($file,''); if(my $pos=rindex($text,'.')) { $endung=substr($text,$pos,(length($text)-$pos),'');} print "$text , $endung\n";