my $x = 'cbs.d'; my $endung = undef; if( $file =~ m/\.([^\.]+)$/ ) {    $endung = $1; } # verwende $endung...