Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday July 17, 2003
11:26 AM

Perl Cookbook

[ #13507 ]

So we're talking about Perl and he asks "how do I read a file, change it, and write it back out again? Do I have to close and reopen it?"

There are many different ways to do this and the best choice depends upon what you need to do, who else might be using the file, the size of the file, etc. Since many of his questions are standard questions I suggested he pick up a copy of the Perl Cookbook.

I then backpedalled (sp?) furiously. The Second Edition of the book should be out in August. I'll just loan him an extra copy and, in the meantime, drool in anticipation at the thought of the second one.

Excuse me now. I have to go wipe the saliva off my chin.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • In general, if your file is line-based, you are probably best off using Tie::File; if you need to change characters (bytes) at a specific location in the file, then you probably want to use things like seek, tell, and the update file open option.

    I put this here not because Ovid doesn't know it, but in case anyone was reading and wondering. ;) There are many other solutions, and it definitely depends on a lot of factors.

    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
  • I was hoping you'd have him buy two copies :-)

    Second edition should be out in September, assuming we survive QC1. I have the first 17 chapters, and it's already 746 pages long. TOO ... MUCH ... PERL!


    • Too much Perl: A statement that, given any reasonable definition of those three words, cannot possibly make sense.

      I wait with great anticipation for the second edition of the Ram. (What I'd really like to see someday is a Complete Perl Bookshelf, up-to-date editions of every book that's been on one of the Shelves. Wouldn't even need a physical copy of the Nutshell, because this would be an item for people who presumably owned a copy of it already. I suspect it's not even close to feasible, but I fig


      You are what you think.
      • You mean a CD-ROM or a big ole pile of books?


        • You're just toying with me now, aren't you?

          I meant the CD-ROM, of course...


          You are what you think.
        • Bookshelf! Bookshelf! Bookshelf!

          It would be fantastically awesome to have "The Compleat Perl CD Bookshelf". Then again owning just about every CD Bookshelf O'Reilly has I can sort of roll my own.

          Hmmm, how does Perldor the Perlinator sound?

          Perldor! Perldor!
          Regexing the countryside. Sexegering the peasants!

          Maybe I'll stop there...don't want to offend Trogdor anymore than I have to. ;-)