sub regex2 { my $pat = shift ; eval q%sub { my $hits = '0'; while ($_[0] =~ /$pat/iogx) {$hits++ ;} if ($hits) { return $hits ; } else { return undef() ; } }%; }