| |||||||
|
|
Click here to download plain text source code.
# subroutine name: readhash_nolock # Reads all the data from $datafile # Returns: reference to the HASH # File format required: <key>\t<value> sub readhash_nolock { my ($datafile) = @_; my %hash; local *DATA; if (open(DATA,"<$datafile")) { my @arr; while (my $line = <DATA>) { 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; } |
|||||||||||||||||||||
| Copyright © 1999-2007 Atomicsoft Ltd. All Rights Reserved. | ||