sub CheckDeployed { chomp (my $id = $_); my $deployedcounter = 0; foreach (<@deployeduid>) { chomp $_; if ( $id eq $_ ) { print "I found $id in the deployedfile with the timestamp of $deployedtimestamp[$deployedcounter]\n"; my $temptime = time; # Set comparetime to current time - 4 days my $comparetime = ($temptime - 86400 * 3); if ($deployedtimestamp[$deployedcounter] < $comparetime) { my $oldtime = $deployedtimestamp[$deployedcounter]; chomp ($deployedtimestamp[$deployedcounter] = $temptime); print TEMPDEPLOYED "$id $deployedtimestamp[$deployedcounter] 2\n" or die $!; return; ### Jumps back to if ( $id eq $_ ) not sure why. } else { chomp $deployedtimestamp[$deployedcounter]; print TEMPDEPLOYED "$id $deployedtimestamp[$deployedcounter] 1\n" or die $!; return; } $deployedcounter++; } elsif ( $_ ne "" ) { #reserved for possible processing } $deployedcounter++ } my $temptime = time; chomp ($deployedtimestamp[$deployedcounter] = $temptime); print TEMPDEPLOYED "$id $deployedtimestamp[$deployedcounter] 1\n" or die $!; return; }