in reply to Re: reading from a file after a seek isn't working for me
in thread reading from a file after a seek isn't working for me
Normally opening with an existing FH closes the original file or at least I never noticed a problem in cutting this corner in one-shots, one-liners or inline shell scripts (but usually avoiding read, sysread, tty's and STDIN/OUT/ERR).
Thanx,
Peter
Update: - ok, any takers for this riddle with more time? Will summarize if pointed correctly with keywords and RTFM's to check :)
From perldoc -f close:
You don’t have to close FILEHANDLE if you are immediately going to do another "open" on it, because "open" will close it for you. (See "open".) However, an explicit "close" on an input file resets the line counter ($.), while the implicit close done by "open" does not.
There are a few more notes on pipes, but those don't seem to match the opener's situation either. Skimming perlopentut I didn't see pointers of interest - au contraire, it even _seems_ to imply that reopening w/o close (my reading on the lack of close() in the Playing with STDIN/STDOUT section) for STDIN/STDOUT is fine. Or is there indeed some hardcoded magic of it being STDOUT we insist to read from??
What do I miss?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: reading from a file after a seek isn't working for me
by almut (Canon) on Oct 21, 2009 at 21:44 UTC | |
by jakobi (Pilgrim) on Oct 21, 2009 at 22:46 UTC | |
by almut (Canon) on Oct 21, 2009 at 23:23 UTC | |
by ikegami (Patriarch) on Oct 22, 2009 at 01:57 UTC | |
by almut (Canon) on Oct 22, 2009 at 07:23 UTC | |
|
Re^3: reading from a file after a seek isn't working for me
by ikegami (Patriarch) on Oct 21, 2009 at 21:09 UTC |