open IN, '<', "/path/to/database.txt"; my %hash; while () { my ($first,@array) = split(/;/, $_); @{ $hash{$first} } = @array; } close IN; print $hash{'3005698'}[1] . " "; print $hash{'3005698'}[2] . " "; print $hash{'3005698'}[3] . "\n";