if ( CheckDeployed( $currentid ) == 0) { # do something } #### sub CheckDeployed { #chomp (my $id = $_); my $id = shift; 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; 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 "0"; } else { chomp $deployedtimestamp[$deployedcounter]; print TEMPDEPLOYED "$id $deployedtimestamp[$deployedcounter] 1\n" or die $!; return 1; } $deployedcounter++; } elsif ( $_ ne "" ) { #reserved } $deployedcounter++ } my $temptime = time; chomp ($deployedtimestamp[$deployedcounter] = $temptime); print TEMPDEPLOYED "$id $deployedtimestamp[$deployedcounter] 1\n" or die $!; return "2"; }