Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > File Handle Reading Blues: Rereading a File Handle for Input

Reply
Thread Tools

File Handle Reading Blues: Rereading a File Handle for Input

 
 
Dietrich
Guest
Posts: n/a
 
      07-19-2004
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.
 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      07-22-2004
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).
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to force rereading of truststore Marc Java 0 06-13-2008 03:44 PM
URL Connection Keeps Rereading the same page Hal Vaughan Java 5 12-16-2007 03:55 PM
Reading from socket file handle took too long Etienne Desautels Python 1 02-27-2006 10:33 AM
Capturing output with simultaneous File handle input thomasjbs@gmail.com Perl Misc 1 07-02-2005 06:37 AM
File Polling (Rereading) Daniel Mueller Python 13 10-23-2004 05:20 AM



Advertisments