#!/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++; }