At 10:14 PM -0700 10/8/09, Soham Das wrote:
Hello All, I am doing some file reading operation, and parsing the
data(its a CSV file) with a hash reference and then intend to store
it in a record. something like: loop: until file ends;
$hashref->{'B'}= $filehandle->{'Name'};
$hashref->{'C'}= $filehandle->{'System'};
$recordref->{$hashref->{'B'}}= $hashref; loop : ends

You are better off including some actual Perl code, including some sample data.
Here Action, Name,System,price are the CSV headers. Now, when the
first line is read, the details are parsed and stored in the
$recordref as a hash reference. Now when the loop iterates, and goes
to the second line. The first line contents are lost. Because the
hash reference now points to the newer data. How do I overcome this?
More importantly do we have a push equivalent for hash of hashes?
No. Unless each record has a unique key, you are better off using an
array of hashes, rather than a hash of hashes. Of course, you could
use the line number as a unique key, but an array would be more

Jim Gibson

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 10 | next ›
Discussion Overview
groupbeginners @
postedOct 9, '09 at 5:14a
activeOct 9, '09 at 12:09p



site design / logo © 2021 Grokbase