Or perhaps a list of lists... Maybe you should describe your HOH better. What do you want the end result to look like?
-----Original Message----- From: Matthew Harrison [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 5:18 PM To: Daniel Falkenberg Cc: [EMAIL PROTECTED] Subject: Re: Can I set this as a hash? I know i'm still only learning perl so feel free to ignore me if i've said something stupid, but wouldn't tha be better as a list instead of a hash? On Tue, 26 Mar 2002, Daniel Falkenberg wrote: > 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 > > -- Matthew Harrison Internet/Network Services Administrator Peanut-Butter Cheesecake Hosting Services Genestate www.peanutbuttercheesecake.co.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]