#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 2; my @x = qw/catch cat foo nocat/; my $str = '2cat6'; my @found = grep { -1 < index $str, $_ } @x; my @want = qw/cat/; is_deeply \@found, \@want, "Found '@found' in '$str'"; $str = '2catch6'; @found = grep { -1 < index $str, $_ } @x; @want = qw/catch cat/; is_deeply \@found, \@want, "Found '@found' in '$str'";