![]() |
So simple a perl question i'm almost embarrassed to ask. (Print text to TOP of file).
OK, to append it's something like:
$mystuff= $formdata{'mine'}; $inputstuff = $formdata{'inputtext'}; open (LOG, ">>stuff.txt") || &ErrorMessage; and to wipe clean and overwrite it's $mystuff= $formdata{'mine'}; $inputstuff = $formdata{'inputtext'}; open (LOG, ">stuff.txt") || &ErrorMessage; but.... how do i make it so that input from a simple form goes to the TOP of my text file whilst keeping everything else that's there? Is there something simple to write instead? or does it involve harder work than it sounds? It seems as if it should be something I already know, but unfortunatly it's either too simple to document on the internet that i've searched so far or no one else ever needs to do this?? :S Sarah. |
Here's what I use for problems like this:
Code:
$mystuff= $formdata{'mine'}; |
aaah, i see how you're doing it... taking it all out of the file, writing the stuff i need to put at the top and then rewriting everything that was already there afterwards. guess they never make it simple, eh?
Anyway, thanks! :) |
I was told lately why there things like this in Perl; the idea is, they give you everything you need and the rest is up to you.
(They give you the ability to write to files, but you have to make it write to the top of the file ;)) Mzzl, Chris |
| All times are GMT +1. The time now is 08:27 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.