Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: what's appens with this FH ??

by krusty (Hermit)
on Oct 19, 2002 at 17:17 UTC ( #206533=note: print w/ replies, xml ) Need Help??


in reply to what's appens with this FH ??

The first open opens c:\winnt\temp\hash.tmp for reading and for writing, but you didn't do a seek to the beginning of the file when you started reading.
Perhaps another wise monk could explain here, but I'm going to guess that since the file was never closed, its not reading an end of file marker and is just pushing out whatever is left in its stack.
You may have noticed the print statement never prints out to STDOUT

aba uba
niba seba
njak yuk

Add a seek and all may be well again:

#!/usr/bin/perl -w open (TEMPO, "+>c:\\winnt\\temp\\hash.tmp"); print (TEMPO "aba uba\niba seba\njak yuk\n"); ############open (TEMPO, "<c:\\winnt\\temp\\hash.tmp"); seek TEMPO, 0, 0; while (<TEMPO>) { print; }


Comment on Re: what's appens with this FH ??
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://206533]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-31 03:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls