@matches=( qr/match1/, qr/match2/, ...); open ($file,"<","/path/to/file") or die ("Horribly"); while (<$file>) { $temp=$_; $temp=~s/\.//g; for my $match (@matches) { if ($temp =~m/$match/) { do_something(); } } }