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)
But you have two flags stating whether the filehandle was opened ! 1) $oldhandle 2) $user_input So, > 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; > }

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