#!/usr/bin/perl -w use strict; my @array = map { qr{$_} } ('^abcd', 'cd[ef]g', 'cat$'); while (<>) { chomp; foreach my $re (@array) { print "Matched $re\n" if m{$re}; } }