Re: checking the status of FileHandle

2001-06-13 Thread Paul
--- Charles Lu <[EMAIL PROTECTED]> wrote: > >Lets say I want my program to print to STDOUT unless the user > specifies that the output goes to a file. Here is my code: > > > > my $oldhandle=undef; > if($user_input ne 'STDOUT') { #user specify output to a > file > open (OUT,

Re: checking the status of FileHandle

2001-06-12 Thread Michael Fowler
> At this point I want to close my FileHandle (OUT) if it was open. My > question is HOW do I check to see whether a filehandle(OUT) has been opened > so I can explicitly close it with The fileno operator is the typical way of determining if a filehandle is connected to something. Michael --

Re: checking the status of FileHandle

2001-06-12 Thread Evgeny Goldin (aka Genie)
he file\n"; > $oldhandle = select OUT; > } > print "blah blah blah\n"; .. and : if ( defined( $oldhandle )){ select ($oldhandle); close OUT; } Well, it's not "checking the status of FileHandle" but solves your problem in easier way, I think

Re: checking the status of FileHandle

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, Charles Lu <[EMAIL PROTECTED]> wrote, > my $oldhandle=undef; > if($user_input ne 'STDOUT') { #user specify output to a file > open (OUT,">$temp.txt") or die "Can't open the file\n"; > $oldhandle = select OUT; > } > > print "blah blah blah\n"; > > select ($ol

checking the status of FileHandle

2001-06-12 Thread Charles Lu
Lets say I want my program to print to STDOUT unless the user specifies that the output goes to a file. Here is my code: my $oldhandle=undef; if($user_input ne 'STDOUT') { #user specify output to a file open (OUT,">$temp.txt") or die "Can't open the file\n"; $oldhandle =