[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Splice troubles



At 09.59 -0500 1998.11.25, lachlan.scott@dresdner-bank.com wrote:
>open (APPEND, "+<file.dat");

In general, Don't Do That.

>@arrayOfLines = <APPEND>;
>
>print APPEND (splice (@arrayOfLines, 2));

If you WERE to open the file with <+, and then read from it and write back
to it, you would need to seek to the beginning of the file.  See seek in
the perlfunc manpage (Builtin Functions help page).

But better yet, see the second item in perlfaq5, Files and Formats: "How do
I change one line in a file/delete a line in a file/insert a line in the
middle of a file/append to the beginning of a file?"

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch