http://www.perlmonks.org?node_id=538821

snyder has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks, I am having a problem running a perl script via cron.. Linux ES4 v2. I run the script at command line and it runs fine. I run it through cron and it does not seem to wait until the tarball is fully created before it FTP's the incomplete tarball. is there a way to make the script complete the "tar" before begining the "ftp"?
#!/usr/bin/perl use IO::Dir; tie %dir, 'IO::Dir', "club"; foreach (keys %dir) { next if $_ eq "."; next if $_ eq ".."; push( @files, "club/" . $_ ); } use Archive::Tar; my $tar = Archive::Tar->new; $tar->add_files( @files ); $tar->write('club_db.tar'); use Net::FTP; $ftpobj = Net::FTP -> new ("192.168.1.21"); $ftpobj -> login("username","passwd"); $ftpobj -> binary; $ftpobj -> put ("club_db.tar"); $ftpobj -> quit;