use warnings; use strict; my @dic = qw#beriberi hanabbs#; for (@dic) { print "trying to match $_\n"; print $_ if $_ =~ m#^(hana)(bbs)?(?(1)\2\1|\1)$#; }
yahoo@myserver ~/.yahoo/perl> !$ simple_grep.pl trying to match beriberi trying to match hanabbs yahoo@myserver ~/.yahoo/perl>
In reply to conditional expression testing by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |