Always start your code with:
use warnings;
use strict;

> my %record = r();
This line won't work. r() returns a reference (think pointer if you
used C) to a hash. You need a scalar to store it.
$record = r();

> $record{fieldA}{fieldB} = value...
This requires a hash, unlike the above line that used a hash. You can
create a hash and assign its reference to a scalar like so:
$ref = \%hash;

> push @records, %record
I think you want an array of references, not of hashed themselves.
I'll let someone who knows more correct me on this one ;)
__CODE__
$array[0] = %hash;
print $array[0];
__END__
It seems the assignment expects a scalar (makes sense) so the value
assigned to the array element is scalar(%hash), which is actually the
"number of buckets and used buckets" or something, ie not what you
want ;)
You definitely want to use a reference.
__CODE__
$array[0] = \%hash;
print $array[0];
__END__
Now you can do something like
print $array[0]->{field_one};
just like you did in your for loop - except you got no semicolon ;)

> #sorting hashes list by one of hash fields - no idea how?...
Take a look at the sort perldoc - the age example is what you want.
`perldoc sort`
or
http://perldoc.perl.org/functions/sort.html

HTH!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to