use warnings; use strict; use File::Remove qw(remove); sub deletefile { my $filename = shift; unless ($filename) { warn "deletefile: Kein Filename angegeben"; return; } unless (-f $filename) { warn "deletefile: '$filename' existiert nicht"; return; } unless ( remove($filename) ) { warn "deletefile: Konnte '$filename' nicht löschen: $!"; return; } return 1; }