Extract particular data from csv file to hash map

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • safiqurr01
    New Member
    • Oct 2011
    • 1

    Extract particular data from csv file to hash map

    I have a csv file with particular data in certain locations.As for example
    20,3678863,Y,Si nha,Varun,51400 195, 051-40-0195,7/19/1947

    3237.14,4656311 ,Y ,Goswami,Nabajy oti,77502793,07 7-50-2793,5/5/1962
    I have 1000+ lines of data.
    I want to extract the second and fourth data in a particular row and put it in a hash map.
    My next task will be to use the second value of each record and search it in some text file.
    Please help me to extract data into a hash map. so that I can continue with the rest...
    Any help is really appreciated. Thanks
  • toolic
    Recognized Expert New Member
    • Sep 2009
    • 70

    #2
    If your data itself does not contain commas, use split to grab the 2nd/4th columns:

    Code:
    perldoc -f split
    Otherwise, search CPAN for an appropriate CSV/xSV module.

    Comment

    Working...