c:\@Work\Perl\monks>perl use strict; use warnings; use Test::More 'no_plan'; use Test::NoWarnings; my %replace = qw( milk white toast brown cheese yellow peas green ); my ($rx_search) = map qr{ (?i) (? 'milky appease peasoup cheese-toast' ], 'parts of all these should change', [ 'mIlK, some PeAs, cheese and toast.' => 'white, some green, yellow and brown.' ], ) { if (not ref $ar_vector) { note $ar_vector; next VECTOR; } my ($string, $expected) = @$ar_vector; (my $replaced = $string) =~ s{ ($rx_search) }{$replace{lc $1}}xmsg; is $replaced, $expected, "'$string' -> '$expected'"; } done_testing; exit; __END__ (?msx-i: (?i) (? 'milky appease peasoup cheese-toast' # parts of all these should change ok 2 - 'mIlK, some PeAs, cheese and toast.' -> 'white, some green, yellow and brown.' 1..2 ok 3 - no warnings 1..3