Help for this page

Select Code to Download


  1. or download this
    $str = 'ababbb';
    $pattern = 'b';
    ...
             + ($str=~/$pattern$/)
             - 1;
    print "$count\n";
    
  2. or download this
    2
    
  3. or download this
    $count = (scalar split /$pattern/, $str, -1) - 1;