use strict; use warnings; use Test::More; my @good = ( 'perfect weather', 'Nobody\'s Perfect', 'PeRfEcT!!', ); my @bad = ( 'imperfect', 'Perfecto!', 'perfection', ); my $re = qr/^perfect\b|\bperfect$/i; plan tests => @good + @bad; like $_, $re, "match for '$_'" for @good; unlike $_, $re, "no match for '$_'" for @bad;