*** This works but inefficient *** $item = ($input{'item'}); #input passed in from html form $found=0; #set $found to zero open(FILE, "myfile.txt") || die("$!") #open for reading while() { #while file is open flock(FILE, 2); @line = split(/ /, $_); #split fields with single space $itemDB = $line[0]; #assign 1st element from DB to $itemDB if ($itemDB eq $item) { $found++ #increment $found if true } #end if **DO I NEED A next, last or continue somewhere?? } #end while flock(FILE, 8); #unlock file close(FILE); #close file if ($found) { #if $found is true &Sub1(); #call this sub if true } else { &Sub2(); #call this sub if false } (html blah, blah)