Hello All,
Just wondering how I would go about setting up the following hash and if
it would be wise to do it this way?
I have the following data...
$username $company $fullname $owing
I want to place all of this in a hash of a hash...
%name_of hash =
"Username1" => "Company1" => "$fullname1" => "$owing"
So basically I want to populate the hash with the above data. Here is
there perl code I have so far...
#!/usr/bin/perl -w
use Data::Dumper;
$FILE_NAME = "vintekdb_query_250302.txt";
$USER_DATA = "/var/www/cgi-bin/$FILE_NAME";
sub read_data {
open USER_DATA, "$USER_DATA" or warn "cannot open '$USER_DATA' for
reading: $!\n";
flock(USER_DATA, 2) || warn "Can't lock $USER_DATA exclusively: $!";
while( $USER_DATA=<USER_DATA> ) {
@USER_DATA = split (/,/, $USER_DATA);
s/^"|"$//g foreach @USER_DATA;
$username = $USER_DATA[0];
$fullname = $USERDATA[1];
$company = $USERDATA[2];
$owing = $USERDATA[3];
#CREATE HASH OF HASH HERE
}
}
close USER_DATA;
return %users; #NAME OF HASH
}
read_data();
Does any one have any ideas on how I would go about this? Is this even
the best way to do something like this?
Regards,
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]