Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert data from a file to a hash

Status
Not open for further replies.

mikawin

Technical User
Apr 15, 2009
28
US
I have about 500,000 records in a file that I want to insert into a hash table. What is the most efficient way to do this?

Thanks,
Mika
 
Something more efficient than:
Code:
my %hash;
while (<>)
{
  my($a,$b)=split ",", $_;
  $hash{$a)=$b;
}
?

What's the format of your file?  Does it include the hash key and value?  Does it include things beside the keys and values?
 
Thanks Chris,

Using the module sped things up for me immensely.

~Mika.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top