How to tell if handle is open?

Discussion in 'Perl Misc' started by Irving Kimura, Jan 10, 2004.

  1. How can my script tell whether a filehandle is open?

    TIA,

    Irv
     
    Irving Kimura, Jan 10, 2004
    #1
    1. Advertising

  2. Irving Kimura

    J Krugman Guest

    In <btp67c$k79$> Irving Kimura <> writes:
    >How can my script tell whether a filehandle is open?


    Check for a nonzero return value from fileno. E.g.

    close OUT if fileno(OUT);

    jill
     
    J Krugman, Jan 10, 2004
    #2
    1. Advertising

  3. Irving Kimura

    J Krugman Guest

    Correction: I meant to write 'look for a *defined* return value
    from fileno'.

    Sorry.

    jill
     
    J Krugman, Jan 10, 2004
    #3
  4. Irving Kimura

    Ben Morrow Guest

    Irving Kimura <> wrote:
    >
    > How can my script tell whether a filehandle is open?


    Use Scalar::Util.

    Ben

    --
    It will be seen that the Erwhonians are a meek and long-suffering people,
    easily led by the nose, and quick to offer up common sense at the shrine of
    logic, when a philosopher convinces them that their institutions are not based
    on the strictest morality. [Samuel Butler, paraphrased]
     
    Ben Morrow, Jan 10, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dietrich
    Replies:
    1
    Views:
    650
    Joe Smith
    Jul 22, 2004
  2. yogesh
    Replies:
    1
    Views:
    372
    Victor Bazarov
    Mar 14, 2007
  3. Oleg
    Replies:
    0
    Views:
    322
  4. Mike A
    Replies:
    17
    Views:
    266
    Dr John Stockton
    Nov 19, 2003
  5. naushil mehta
    Replies:
    2
    Views:
    397
    Christopher Pisz
    Mar 26, 2012
Loading...

Share This Page