Perl snippets 1

Tagged:

Zakladni konstru v perlu, ktere si stejne casem zapamatuju, ale ted je pohodlnejsi si je zapsat sem. :)

Hash of Hashes

my %people;
$people{"man"} = {
  "Clark Arthur" => 1, 
  "Smith James" => 3, 
  "Smith John=>5};
 
foreach $gender (keys %people)
{
  print "$gender: \n";
  $hashRef = $people{$key};
  foreach $name (keys %$hashRef) { 
    print "\t $name --> $$hashRef{$name}\n"; 
  }
}

Similar