File Handle Reading Blues: Rereading a File Handle for Input
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>;
20 chomp ($DB_MAIN_NAME=`echo \$profile`);
21 #system "echo \$profile";
22 print "DB_MAIN_NAME = '$DB_MAIN_NAME'";
24 print "\nGeorge W.";
26 while (<INVARS_READ>)
27 #while (print INVARS_NW <INVARS_READ>)
Re: File Handle Reading Blues: Rereading a File Handle for Input
> 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.
P.S. Next time, post to comp.lang.perl.misc and not here (comp.lang.perl).
|All times are GMT. The time now is 10:14 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.