............................................................................... # prüfen ob file vorhanden ist my $check= grep /\Q$new\E/, $ftp->ls; if ($check) { die "achtung file existiert !\n" and next; { #nur wenn file vorhanden eine error mail schicken open(MAIL, "|/usr/sbin/sendmail -t") || die "Cant send mail. Reason: +$!"; print MAIL "from:$sender\n"; print MAIL "to:$recipient\n"; print MAIL "subject: file existiert !\n"; print MAIL "file existiert ! \n"; close(MAIL); } } #quit FTP $ftp->quit; ...............................................................................