File Handle Reading Blues: Rereading a File Handle for Input

Discussion in 'Perl' started by Dietrich, Jul 19, 2004.

  1. Dietrich

    Dietrich Guest

    Hi.
    I can't reread a file handle after I have copied it on another file
    handle for output. Here is the code snippet. Please let me know if
    you need more.
    Lines 26 & 27 are my attempts to get read the input file again. Line
    18, where I copy the input file handle to the output file handle works
    fine. I am using Perl 5.6.1 on HP-UX 11.00.

    18 print INVARS_NW <INVARS_READ>;
    19
    20 chomp ($DB_MAIN_NAME=`echo \$profile`);
    21 #system "echo \$profile";
    22 print "DB_MAIN_NAME = '$DB_MAIN_NAME'";
    23
    24 print "\nGeorge W.";
    25
    26 while (<INVARS_READ>)
    27 #while (print INVARS_NW <INVARS_READ>)
    28 {

    Thank you.
     
    Dietrich, Jul 19, 2004
    #1
    1. Advertising

  2. Dietrich

    Joe Smith Guest

    Dietrich wrote:

    > 18 print INVARS_NW <INVARS_READ>;


    That reads the entire contents of the input file, all the way to the
    end of the file, and sends it to the output. Once you've read
    all the way to EOF, you cannot read anymore. Either close and
    re-open the input file, or learn how to use the seek() function.
    -Joe

    P.S. Next time, post to comp.lang.perl.misc and not here (comp.lang.perl).
     
    Joe Smith, Jul 22, 2004
    #2
    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. Max
    Replies:
    0
    Views:
    466
  2. {AGUT2}=IWIK=
    Replies:
    9
    Views:
    410
    {AGUT2} {H}-IWIK
    Sep 1, 2003
  3. Daniel Mueller

    File Polling (Rereading)

    Daniel Mueller, Oct 21, 2004, in forum: Python
    Replies:
    13
    Views:
    3,832
    John Taylor
    Oct 23, 2004
  4. Hal Vaughan
    Replies:
    5
    Views:
    340
    Hal Vaughan
    Dec 16, 2007
  5. Marc
    Replies:
    0
    Views:
    369
Loading...

Share This Page