sub get_index(){ my $file = shift; my $indexfile; open FILE,$file; while(){ chomp; my @array = split /\,/,$_; if($#array){ $indexfile->{$array[1]} = $array[0]; } } close FILE; return $indexfile;