If you want to write at a specific location, use the
seek function. I doubt however that you can
use it for a guestbook. Unless you write fixed size records.
Abigail | [reply] [d/l] |
| [reply] [d/l] |
Guestbooks generally slurp the entire file. Then split on a specific line of text in the file
(i.e. <!-- Add Guestbook Entries Here -->).
Then it's simply a matter of writing out both sections of the guestbook file with the additional text added in between.
| [reply] [d/l] |
| [reply] |
Maybe I'm being thick, but can you explain the guest book comparison?
The only way that I know how a guest book works is that new stuff gets appended to the end of the file. It sounds like you're talking about seeking to somewhere inside the file, that is, not to the beginning or the end.
Help us understand the 'guest book' referencek, and I'm sure we can provide suggestions on a solution.
--t. alex
but my friends call me T.
| [reply] |
Well, as I couldn't figure out how to go back and update my original post, I'm doing it thusly! My solution (ala Mr. Muskrat): I slurped the file into a $var, split it on the magic line ("add here"
, basically) into an @file, then opened the file again, printed into it $file[0], my new crap, magic line, $file[1]. close file. BINGO! My thanks to all who have helped me. This has definitely been a learning experience and I'm getting more and more intimate with perl. Almost to second base... (oh, baby) _____________________________________________________ mojobozo
word (wûrd)
interj. Slang. Used to express approval or an affirmative response to something. Sometimes used with up. Source | [reply] [d/l] [select] |