# subroutine name: readhash_nolock # Reads all the data from $datafile # Returns: reference to the HASH # File format required: \t sub readhash_nolock { my ($datafile) = @_; my %hash; local *DATA; if (open(DATA,"<$datafile")) { my @arr; while (my $line = ) { if ($line =~ m/^(.+?)\t(.*?)[\n\x0D\x0A]*$/) { my ($key,$value) = ($1, $2); push (@arr, (unsafe($key), unsafe($value)) ); } } # Sort everything at once %hash = @arr; close(DATA); } else { die "Error in subroutine readhash: Can't open $datafile: $!"; } \%hash; }