Help for this page

Select Code to Download


  1. or download this
    sub match_all_ways {
        my ($string, $regex) = @_;
    ...
    
    print match_all_ways("abcdef", qr/..*..*./); # 20
    print match_all_ways("abcdef", qr/..*..*./); # undef
    
  2. or download this
    sub match_all_ways {
        use vars '$count';
    ...
        $string =~ /(?:$regex)$incr(?!)/;
        return $count;
    }
    
  3. or download this
    {
      my $count;
    ...
          return $count;
      }
    }