On 6/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Actually,
> 
> you are incorrect... The +>> mean read and write in append mode.  Please
> see the follow up email with the attachment I sent.
> 
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
> 614-566-4145

While you are correct, please don't do this. It's a great way to get
yourself into trouble and really only serves to obfuscate your code
and ensure that filehandles remain open when they aren't being used,
eating up kernel resources.

When you need to read from a file, open it, read from it, and close
it. then when you're ready to write to it, open it, write to it, and
close it.

If you really insist on obsfucation (using "for (;<>;)" and using your
own variable when $. or $.-1 would suffice indicate you might) make
sure you use appropriate select() calls to make sure you're not
getting premature EOF, and depending on your OS, also when switching
from reading to writing, and vice versa.

But really, the perl philosphy is to keep the simple things simple.
And reading a file, printing a few lines you want, and closing the
file is about as simple as it gets. in fact, it's a one-liner:

  perl -lne 'print unless /^-{5}/' your_file

-- jay
--------------------
daggerquill [at] gmail [dot] com
http://www.tuaw.com
http://www.dpguru.com
http://www.engatiki.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to