if I remember correctly, the handle will close when it goes out of scope or the script terminates, but some one else will have to verify that, I can't find where it says that in any of my books right now. on that not note, if you can you would be better off closing the handle yourself right be fore the last statement.
as far as the print HANDLE "statement" or last; have you tried it, the worste that would happen is it wouldn't work. I don't know. I'm going to run a test script to see what happens and I'll let you know.

Update: I was unable to get print HANDLE "statement" or last; to work in the for loop like you where wanting to do, the program kept crashing, and I have been unsuccessful in conferming what I said about handle scope, I've run acouple of searches on this site and couldn't find a messages that directly covered it.

jjdraco
learning Perl one statement at a time.

In reply to Re: Managing Process Handles by jjdraco
in thread Managing Process Handles by insensate

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.