Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I am new to perl and currently I writing a perl script for manipulating large data with hel of lookup in hash. I have lookup file with (created from database) phone-number,group-id,start-dat,end-dat values , this file will have 100k records and i get have a file with phone number(both calling and caled number ) and call time . so i have to look up the calling number and called number in the look up file to get the group id and start time and end time. I thought of pushing all 100k records to hash from the file and the do the comparison, but I am stucked at the point, which value should be given as key value.what i understood from tutorial that key value should be unique, but in my case first I thought of putting phone number as key, but there is always a chance the phone number can be blong to differnt group for different startdate and end date.I cannot overwrite the old data also. I have mainly two concerns 1>100k records fetching to a file and push that data to hash at the begginning of the script is better or directly accesing database and push data to hash is better approach. 2>how can make unique key with these combination or is ther any way out of it? plz hel me... thax in advance

Replies are listed 'Best First'.
Re: how to define key for a hash
by davorg (Chancellor) on Jun 25, 2009 at 12:18 UTC
      hooo... i need to do this activity in every fifteen mins. so populating the hash from database in every fifteen mins is not an issue?

        See perl database access and my answer Re: perl database access. It would help us to help you better if you tried to state more of the problem instead of trying to feed it piece by piece. It will also help us to provide you with more answers geared towards reaching your goal if you actually read our answers and provide the information needed and do the work that needs to be done.