Redirects standard input and output and turns off buffering. : select « File « Perl






Redirects standard input and output and turns off buffering.

    
#!/usr/local/bin/perl 

open (STDOUT, ">file1") || die ("open STDOUT failed"); 
open (STDERR, ">&STDOUT") || die ("open STDERR failed"); 
$| = 1; 
select (STDERR); 
$| = 1; 
print STDOUT ("line 1\n"); 
print STDERR ("line 2\n"); 
close (STDOUT); 
close (STDERR); 

   
    
    
    
  








Related examples in the same category

1.Selecting A Log File
2.The select Function