Help for this page

Select Code to Download


  1. or download this
     
      my $buffer ;
            while (sysread TEXT, $buffer, $buffer_size) {
          ## This will use tr to count fast for you:
               $words += ($buffer =~ tr/ +\n+,://) ;
          }
    
  2. or download this
    $fname =  "haystack.test";
    open(TEXT, "<$fname")|| die "could not open file: $fname\n";
    ...
    
    print"\n";