On Sat, Mar 09, 2002 at 11:36:08PM -0800, Troy May wrote:
> How do you write to the beginning of a file?
That's an easy one: Just turn the file around, and append to its end.
# cat > regular
first
second
third
^D
# mkfifo backwards
# while : ; do tac regular > backwards; done &
[1] 18464
# cat b
Troy May [[EMAIL PROTECTED]] quoth:
*>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.
*>
*>I tried seeking to the beginning before the write, but it doesn't work.
*>Seek must only work fo
Troy May wrote:
>
> Hello,
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.
>
> I tried seeking to the beginning before the write, but it doesn't work.
> Seek must only work for a read.
>
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");
n
--Original Message-
From: Troy May
To: Perl Beginners
Sent: 3/9/02 11:36 PM
Subject: Writing to beginning of file
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.
I tried seeking to the beginn
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.
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