I am very new to perl and was wondering after I ftp a file is there a way to delete that file from the local machine without closing the session? i.e. can I
sub put {
my $this = shift;
my $rc = $this->connect();
if ( $rc ) {
$this->error( "Connect failed" );
return $rc;
}
foreach my $file ( @_ ) {
$rc = $FTP->put( $file );
if ( ! $rc ){
$this->error("Put of file failed: $file"
return "Put of file failed: $file";
}
$this->info("\nSuccessful put of file: $file"
unlink($file);
}
0;
}
So the remote machine has the file but the local machine does not, then close the session from a different function.
sub put {
my $this = shift;
my $rc = $this->connect();
if ( $rc ) {
$this->error( "Connect failed" );
return $rc;
}
foreach my $file ( @_ ) {
$rc = $FTP->put( $file );
if ( ! $rc ){
$this->error("Put of file failed: $file"
return "Put of file failed: $file";
}
$this->info("\nSuccessful put of file: $file"
unlink($file);
}
0;
}
So the remote machine has the file but the local machine does not, then close the session from a different function.