... while (1) { ... for my $tgz ( <*.tgz> ) { # wait 1 min for safety if Tar file would not finished the fill next unless time - (stat($tgz))[9] > 60; my @file = Archive::Tar->extract_archive($tgz, 1); ...