##
if ( -z $infile ) {
unlink $infile or die "Can't unlink empty file '$infile': $!";
next FILE;
}
####
eval {
my $parser = Text::CSV::Simple->new;
my @data = $parser->read_file($infile);
}; # don't forget the semicolon!
if ( $@ ) {
if ( $@ =~ /the error you expect/ ) {
unlink $infile;
next FILE;
}
# unexpected error!
die $@;
}