#!/usr/bin/perl -w use strict; use Test::More tests => 3; use Test::Differences; my @input = qw(nope skip uh-uh no yes stop yup not-me groovy wrong okay); my @output = qw(yes yup groovy okay); my $re = qr/y/; eq_or_diff( [ grep( /y/, @input ) ], \@output, "Embedded RE" ); eq_or_diff( [ grep( $re, @input ) ], \@output, "Compiled, passed RE" ); eq_or_diff( [ grep( /$re/, @input ) ], \@output, "Compiled, but slashed RE" );