use File::Spec; my $path = q{ABCDEF\AB1010\datei.txt}; print $path; my $file = (File::Spec->splitpath($path))[-1];