http://qs321.pair.com?node_id=533658


in reply to is filehandler used ?

Ok, here is the situation, if the filehander is used, I would like to use it
if ( OUT ) { print OUT " bla bla\n" ; }
unfortunately, if ( OUT ) is always true!!
Hopefully this makes sense

Luca

Replies are listed 'Best First'.
Re^2: is filehandler used ?
by Kanji (Parson) on Mar 01, 2006 at 14:53 UTC
    if (defined fileno(OUT)) { print OUT "bla bla\n"; }

        --k.


      any idea of the diff between yours and mine? I've always used *HANDLE:
      use strict; use warnings; open(OUT, ">test.txt") or die "Can't open file to write, $!."; if(defined fileno *OUT){ print "File handle is valid."; }else{ print "Nope."; } close OUT;
        No diff. \*HANDLE also works.