Help for this page

Select Code to Download


  1. or download this
    my $bufflen = 4 * 1024; #or w/e
    
    ...
        $result = read ( IN, $buffer, 
                $bufflen-length($buffer), length($buffer) );
    } while ( $result && ( length($buffer) < $bufflen ) );
    
  2. or download this
    my $newline = "\n"; #or some other unique record separator
    
    ...
    
    ## this is important: prefix the remainder before next chunk
    $buffer = $remainder;
    
  3. or download this
    $buffer .= <IN>;
    
  4. or download this
    foreach my $regex (@conversions) {
        my @results = ( $buffer =~ s/$regex->{from}/$regex->{to}/g );
    ...
    }
    ## and do whatever with the result
    print OUT $buffer;