in reply to How to use hashes well

Greetings all,
Im not sure what it is that you want but here is an option...
#!/usr/bin/perl -w use strict; use Dumpvalue; my @ACCTS; open(IN, "< myfile") || die "Help!\n"; while (<IN>) { my ($id, $name, $street, $city, $zip, $phone, $start_dt) = split(/\|\| +/, +$_); ###push onto the array ACCTS an anonymous hash reference from the valu +es you just split. push(@ACCTS, {'name' => name, 'street' =>$street, 'city' =>$city, 'zip +' =>$zip, 'phone' =>$phone, 'start_dt' =>$start_dt, 'id' =>$id}); } close IN; ###always check what you have created. dump_ref(\@ACCTS); sub dump_ref { my $ref = shift; my $dumper = new Dumpvalue; $dumper->dumpValues($ref); }
The above methodology will create an array of hashes. I assumed that ACCTS was probably referring to account information so a list of accounts is probably what you are looking for... though I could be wrong. So each account record is now an anonymous hash within your ACCTS array.
This way something like
foreach(@ACCTS){ #dereference the elements of the hash contained in this #row of your array with the arrow... its just easier to #read in my opinion. print "This accounts id is ".$_->{id}."\n"; }
Would be how you get back at your data.
The dump_ref sub simply shows you the internals of any nested datatype you create.
Hope that helps.
-injunjoel