--- "Shepard, Gregory R" <[EMAIL PROTECTED]> wrote:
> Thanks for correcting this - You are correct...
> I wasn't thinking about append. Actually, I was thinking about just
> writing to another file.
> My sincere apologies
Understood.
Hope I didn't come off as too much of a jerk. =o)
Paul
> -----Original Message-----
> From: Paul [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 02, 2001 4:54 PM
> To: Shepard, Gregory R; '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: RE: input output append
>
>
>
> WARNING -- careful with this.
>
> > Try....
> > ----------------------------
> > $Directory=<your directory here>
>
> Assuming the above was pseudocode,
>
> > $file="$directory.$file.txt"; # don't forget to add "\" between dir
> > # and file
>
> The above will put .'s in your filename.
> Replace the .'s with /'s (as I assume the comment meant)
>
> > open FH, ">$file" or die "Cannot open $file:$!";
>
> THIS WILL NOT APPEND.
> THIS IS A TRUNCATING OPEN.
>
> This will immediately open a *new* $file, losing any data that was
> previously in $file.
>
> > print FH "blah \n";
> > print FH ""blah \n";
> > print FH ""blah \n";
>
> The 2nd and 3rd of these are syntax errors.
>
> I commend the author for his effort to be helpful, and point out that
> I
> have written some really stupid things to this list. =o)
> Please don't think I'm picking on the author here.
>
> But please, be careful when you post advice.
> Don't write with blatant errors (though we all make mistakes),
> and in particular, don't advise code that will damage someone's data.
>
> For an appending read-write open, use
>
> open FH, "+>>$file" or die "$!: $file";
>
> This will only append (you can ONLY write to the end of the file),
> and
> it is read-write access which will create the file if it didn't
> previously exist. It will not harm data that already exists (unless
> you
> write trash to it, which is another matter. =o)
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo!
> Messenger
> http://phonecard.yahoo.com/
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]