(dan baker) wrote in
news: om:
> "blnukem" <> wrote in message
> news:<Y2i_c.5572$ et>...
>> Hi All
>>
>> I looking for a simple way to update multiple lines in a flat file
>> from incoming array with multiple values the file structure goes like
>> this: Part-number | Name | Quantity
>>
>> The file looks like this:
>>
>> 123456|headlamp|6
>> -----------------------------------------
>
> this looks like a pretty good candidate to use a tie()ed hash DBfile
> rather than a flat text file read in and out.... Be a lot faster and
> use less memory probably.
>
> If you insist on a flat text file, and its not *huge* I guess you
> could read it all into a hash in memory, do your thing, and then write
> it all back out (overwriting the old file).
It also looks like a good candidate for DBD::CSV, which wouldn't require
any changes to the file format and which has the insert/delete/select
functionality already written. But if that's overkill, then Tie::File
(which is included with the standard Perl distribution) would probably be
helpful.