#!/usr/bin/perl use warnings; use strict; my @regexes = qw(one two three); my $line = "this is thREE"; my $i = 1; for my $regex (@regexes){ if ($line =~ /$regex/i){ print "$i\n"; } $i++; } #### open my $log_report, '>>', $log_file or die "Can't open the file $log_file: $!";