my @array = qw( foo bar baz quux xyzzy); my @matched; for my $elem ( @array ) { push @matched, $elem if $elem =~ m/(.)\1/; } print "$_\n" for @matched;
See perlre and search for "backreference" or for "find first doubled" for more explanation.
In reply to Re: Match 2 same characters
by mr_mischief
in thread Match 2 same characters
by paragkalra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |