Is $file a directory or a file? If you want to delete a directory, use rmdir (if it's empty) or rmtree in File::Path (if it's occupied). If you unlink a file, the error will be in $! (not $@). See perlvar. Finally, your warn refers to a $filename variable that isn't used anywhere else. Maybe what you're trying to do is:
my @dir = $ftp->($file); if ( $dir[0] =~ /$size/ ) { unlink $file or die "Can't unlink '$file': $!"; } else { warn "File size differs for $file ($size): $dir[0]\n"; }
In reply to Re: Code Error Question
by kyle
in thread Code Error Question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |