if ( "true" == $flag ) { open ( OUT, "output.txt" ) or die ( "could not open output.txt: $!" +); } else { <OUT> = <STDOUT>; } print OUT "If $flag is true, this line will go to the file output.txt\ +nIf $flag is false, it will go to standard output\n";
If that code is not right, can someone tell me how to do something in that spirit (read the print statement for what I want it to do).
Thanks in advance,
JAPH
In reply to can you assign file handles? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |