Help for this page

Select Code to Download


  1. or download this
    my %fh;
    
  2. or download this
    while(<>) { # the line read is stored into $_
        chomp; # remove line ending character from $_
        ...
    }
    
  3. or download this
        my( $data, $fh_token ) = split /\s*:\s*/;
    
  4. or download this
        if( ! $fh{$fh_token}) {
            open my $fh, '>', "$fh_token.txt"
    ...
            $fh{$fh_token} = $fh; # store filehandle
        }
        my $fh = $fh{$fh_token}; # this is the filehandle to print to
    
  5. or download this
        print $fh $data, "\n"; # append a line break. You'd use "\r\n" on 
    +windows.
    
  6. or download this
    my %fh;
    while(<>) { # the line read is stored into $_
    ...
        my $fh = $fh{$fh_token};
        print $fh $data, "\n"; # append a line break. You'd use "\r\n" on 
    +windows.
    }