Help for this page

Select Code to Download


  1. or download this
    # Open log file once
    open(MYFILE, '>>', $qfn)
    ...
    ...
    
    print_to($to_file ? *MYFILE : *STDOUT, $str);
    
  2. or download this
    open(my $MYFILE, '>>', $qfn)
        or die("Cannot open file $qfn for appending: $!\n");
    ...
    ...
    
    print_to($to_file ? $MYFILE : *STDOUT, $str);
    
  3. or download this
    my $MYFILE;
    if ($to_file) {
    ...
    }
    
    print_to($MYFILE, $str);