Help for this page

Select Code to Download


  1. or download this
    while (<FILE>) {
         $count += () = m/foo/g
    }
    print $count;
    
  2. or download this
    while (<FILE>) {
        while (/foo/g) {
    ...
            print "$count so far.\n";
        }
    }
    
  3. or download this
    my $count;
    while (<FILE>) {
       if ( $count += s/foo/foo/g ) { print "$count so far\n" )
    }