my $thr = threads->new(\&check_fw_logs); my @ReturnData = $thr->join; print "Thread returned @ReturnData"; sub check_fw_logs { my @ips; open (FILE, $fw_file) or croak("Can't open $fw_file: $!\n"); while(){ for my $i (@allips){ push(@ips, $_) if /$i/; } } return @ips; }