theSeeker03
Programmer
I have a tab delimited file that I want to read in, such that each line is a hash and the entire file is an array of the hashes. To test it, I am printing a CityName. What's wrong with this picture?:
my @arrayOfContacts;
my $numOfContacts =0;
while (<INCONT>){
chomp($_);
$arrayOfContacts$numOfContacts]{"CONT_ID",
"ADDR_1","ADDR_2","CITY_NAME"}= split(/\t/,$_);
$numOfContacts++;
}
print "$numOfContacts\n";
print "$arrayOfContacts[$numOfContacts]{CITY_NAME}\n";
my @arrayOfContacts;
my $numOfContacts =0;
while (<INCONT>){
chomp($_);
$arrayOfContacts$numOfContacts]{"CONT_ID",
"ADDR_1","ADDR_2","CITY_NAME"}= split(/\t/,$_);
$numOfContacts++;
}
print "$numOfContacts\n";
print "$arrayOfContacts[$numOfContacts]{CITY_NAME}\n";