in reply to Finding multiple words from a line of flatfile

The /g at the end of each regexp makes it remember where in the line it has reached. Each match starts from where the previous one ended. Get rid of them and it should do what you intended.
#!/usr/bin/perl -w use strict; my $hdata = 'FALCHE;12;ff;20020101;Pori;Yyteri;lietteet;testi;kylma'; my $crit1 = "pori"; my $crit2 = "yyteri"; if (($hdata =~/$crit1/i) && ($hdata =~/$crit2/i)) {print "$hdata\n"}