Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: can you assign file handles?
by chromatic (Archbishop) on Jan 30, 2001 at 03:11 UTC | |
|
Re: can you assign file handles?
by Fastolfe (Vicar) on Jan 30, 2001 at 03:25 UTC | |
|
Re: can you assign file handles?
by runrig (Abbot) on Jan 30, 2001 at 03:29 UTC | |
|
Re: can you assign file handles?
by hotyopa (Scribe) on Jan 30, 2001 at 03:11 UTC | |
by bbfu (Curate) on Jan 30, 2001 at 07:23 UTC |