in reply to Re: Read the csv file to a hash....
in thread Read the csv file to a hash....
Any reason to switch the keys and values? :-)$hrec{'Comments'} = \@names; $hrec{'Names'} = \@comments;
Another solution would be to store the pairs "Name / Comment" in a simple hash... unless the OP really needs to preserve the order. While I don't see the importance, it could be that way it has to, whatever the reason the person who gave the assignment (if it is).
Update
the best solution would be using Text::CSV_XSI'd say that the core problem is arranging the data structure, not parsing the source file. While using that module might be one of the best among its competitors, it does solve only half the problem.
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
|
|---|