AtomicSoft.com Add power to your website!
Home Products Services Support Free
EasyData/SQL
easy-to-use web interface for SQL databases with countless features
AtomicDesk
help desk, FAQ, knowledge base, live support chat - all in one product
Custom programming
Installation
Documentation
HelpDesk
Libraries
Join our newsletter for information on software updates and new releases. You may unsubscribe at any time.



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.