Help for this page

Select Code to Download


  1. or download this
    $ perl -lne '$c += () = /foo/g; END { print $c }'
    
  2. or download this
    my $c;
    while (<>) {
        $c += () = /foo/g;
    }
    print $c, "\n";