Jim Gibson said:
This is a "Frequently Asked Question". Unfortunately, the FAQ for Perl
only has one recommendation: using the Tie::File module. If you are new
to Perl, learning about the "tie" concept may confuse you, as may using
modules, although you will definitely benefit from learning how to use
modules.
I too find it unfortunate that the FAQ doesn't explain the process
in more detail. Typical file-manipulation tools (most notably editors)
give the user the impression that a file is something like an array
of lines on disk. Many beginning programmers have this mental image.
Understanding that a file is really one homogeneous lump of bytes
is a necessary step for a new programmer. This FAQ would be a good
opportunity to set the concept right and explain the consequences.
Instead it does all it can to preserve the inappropriate mental
image.
I think the original content of the FAQ (which explained the manual
process of inserting lines etc.) should be put back in, rewritten if
necessary. A good opportunity to win wealth and fame with a doc
change
Anno