Help for this page

Select Code to Download


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