sub GetDecUser { if (-e $LOGFILE12) { $LFILE = \@arr12; # if the 12 log exist, use it } else { $LFILE = "\@arr10"; # $LFILE = @arr10; # Tried this and this just seems to loop through the whole log } print "$LFILE\n"; # this prints @arr10, so the scalar is getting populated for $dec ("$LFILE") # Use what ever log was found in the above if statement #for $dec (@arr10) # this works fine, but its not using the assignment! { if ($dec =~ /declared users/) # match this { print "TESTING we found it: $dec\n"; # Nothing outputted when I try this. } } }