Hi, as it is only my second week of perl I would be grateful for some
help with hashes. I need to build a list of multidimensional hashes
one by one, sort it by one of fields and iterate through it later.

1. building a hashes

sub t {
  return {
    a => 1,
    b => 2,
  }
}

sub r {
  return (
    c => t(),
    d => t(),
  )
}

my %record = r();
my @records;

loop
  #setting record fields/overwriting defaults
  $record{fieldA}{fieldB} = value...
  #pushing record on list
  push @records, %record
  #preparing new record
  %record = r()

#sorting hashes list by one of hash fields - no idea how?...
...

#looping through list
for $rec (@records)
  print $rec->{fieldA}{fieldB}

Big thanks in advance for helping with this idea / correcting mitakes.
BR


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


Reply via email to