# we enter here with a hostname $host and must look it up # in a file containing details for >100K hosts open FH, $hosts_file or die "something appropriate\n"; while () { ($a,$b,$c,$d)=split $_, /\t/, 4; # first entry in each line is hostname # $b is the data we need for the host $hash{$a}=$b; } if (exists $hash{$host}) { return $hash{$host} } else { return error } # needles to say %hash was global, well everything was # and %hash used again