February 2012
Intermediate to advanced
1184 pages
37h 17m
English
You can set a key/value pair of a particular hash as follows:
$AoH[0]{husband} = "fred";To capitalize the husband of the second array, apply a substitution:
$AoH[1]{husband} =~ s/(\w)/\u$1/;You can print all of the data as follows:
for $href ( @AoH ) {
print "{ ";
for $role ( keys %$href ) {
print "$role=$href–>{$role} ";
}
print "}\n";
}and with indices:
for $i ( 0 .. $#AoH ) {
print "$i is { ";
for $role ( keys %{ $AoH[$i] } ) {
print "$role=$AoH[$i]{$role} ";
}
print "}\n";
}Read now
Unlock full access