Troy May wrote:
> 
> Hello,
> 
> How do you write to the beginning of a file?  I see only 3 options to open a
> file:  to read, to overwrite, and to append to the end of the file.
> 

If you think about the file as an array with one char on each index:
my @string = split (/|/, "this is a test");
now $string[0] eq 't', if you want to insert a char before that you (or
a build in function) will have to make the array 1 index larger, move
everything ahead one step and set the first char to whatever you want it
to be.
The same goes for files, you can open a new file, print what you want to
have first, append the old file and rename it to the old filename. Or
you can use the build in functios for it (look at -i flag in 'perldoc
perlrun').

/jon

> I tried seeking to the beginning before the write, but it doesn't work.
> Seek must only work for a read.
> 
> Any ideas?
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to