#!/usr/bin/perl use strict; use warnings; use MIME::Lite; use File::Copy qw(copy); my $dir = '/verzeichnis/'; my $file = $dir . 'tttt.txt'; if( -e $file ){ my ($d,$m,$y) = (localtime time)[3..5]; my $date = sprintf "%02d%02d%04d", $d,$m+1,$y+1900; my $new = 'tttt' . $date . '.bak'; copy $file, $new; } else{ my $mail = MIME::Lite->new( From => 'any_address@domain.example', To => 'chef@domain.example', Subject => 'tttt.txt nicht da', Data => 'Gude Chef, tttt.txt ist nicht da!', ); $mail->send; }