in reply to Finding multiple words from a line of flatfile

By the way, you say you want to find 1-3 matches per line, but the && signs in your regex mean that actually you are only succeeding if all three searches succeed.

If you really want 1, 2 or 3 matches swap these for || signs:

if (($hdata =~/$crit1/i) || ($hdata =~/$crit2/i) || ($hdata =~/$crit3/i)) { print "$hdata<br>"; }

Replies are listed 'Best First'.
Re: Re: Finding multiple words from a line of flatfile
by Anonymous Monk on Aug 01, 2002 at 17:10 UTC
    I really want to get 1 or more matches.I have a little trick for this. if($crit1 eq "") { $crit1="\;" # there is 7 ; in every line so it matches :) } Same with $crit2 and so on... Thank you all folks!