There's no need to shell out to ls to get a list of files, you can simply say
in reply to file listing within skript not working
my @files = glob "$datenDir/*.xml";
(assuming that $datenDir doesn't contain whitespaces or other nasty stuff; but that would a problem with your approach too).
So why is the backtick-ls working with perl -e but not within a script?
I'm very sure it's not script vs. -e, but that there is some other difference. Is the directory the same in both cases? Is the script run as the same user, with the same security context (if you use selinux) as your one-liner?