if (/$hit[0]/ || /$strike[1]/) { #### if (/$hit[0] && /$strike[1]/) { #### 1028804576 fred@yahoo.com fred mother #### 1028804571 mum@yahoo mother fred # This would also match, and would be found earlier # ^^^^^^ ^^^^ 1028804572 wilfred@hotmail wilf mother # This would also match and be found earlier # ^^^^ ^^^^^^ #### if ( /$userid[ \t]+$password$/ ) { # [ \t]+ means one or more spaces or tabs ($/) means at the end of the line. #### $userid = quotemeta $userid; $password = quotemeta $password; if ( /$userid[ \t]+$password$/ ) { #### if ( /\Q$userid\E[ \t]+\Q$password$\E/ ) { #### #! perl -w my $flag = 0; for (@raw_data) { if ( defined $hit[0] and $hit[0] # has a value that is non-null and defined $strike[1] and $strike[1] # ditto and /\Q$hit[0]\E[ \t]+\Q$strike[1]\E$/) { print "Found it."; $flag = 1; last; } } if (! $flag) { # didn't find it in the array print "didnt find it"; }