# This is just like the section before the sleep, but it's after $ftp = Net::FTP->new ($server, Timeout => 9000, Debug => 3); $ftp or die "$server: cannot connect: $@"; # If you don't use ~/.netrc $ftp->login ($user,$password) or die "$_: cannot logon: " . $ftp->message; # change remote directory for the first file $ftp->cwd($destination); # # this is new my $found = grep /\Q$new\E/, $ftp->ls; if ($found) { die "The file is still there!\n" }