home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!uvaarpa!mmdf
- From: Martin {martlbub} Kraegeloh <krm@pri-mu.prime.com>
- Subject: problems opening a file read/write
- Message-ID: <1992Sep9.094428.16363@uvaarpa.Virginia.EDU>
- Sender: mmdf@uvaarpa.Virginia.EDU (Mail System)
- Reply-To: krm%pri-mu.LOCAL@pri-mu.prime.com
- Organization: The Internet
- Date: Wed, 9 Sep 1992 09:44:28 GMT
- Lines: 31
-
- Hi net,
-
- I tried the following small piece of code:
-
- --------------------------------
- #!/bin/perl
- open(TEST,"+>tst")||die "open";
- while($_=<TEST>){
- if (/add/){
- chop ;
- $_.="ADD\n";
- }
- print TEST $_ || die "print";
- }
- close(TEST) || die "close";
- --------------------------------
-
- Now the problem:
-
- If I use open with "+>filename", the file will end up empty.
- If I use "+<filename", it will remain unchanged.
-
- I guess I am doing sth. wrong, but WHAT IS IT ??
- (I checked the faq without success)
-
- my perl version:
-
- $RCSfile: perl.c,v $$Revision: 4.0.1.4 $$Date: 91/06/10 01:23:07 $
- Patch level: 10
-
- Thanks, Martin
-