http://qs1969.pair.com?node_id=748637


in reply to short method to print age.

This mimics what you do.
print "Alex children are \n\n " , join("\nand ", map $_->{age}, reverse @{$alex{children}}) , "years old\n";
Obviously the reverse isn't necessary unless you really want it.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: short method to print age.
by zouz (Initiate) on Mar 05, 2009 at 19:42 UTC
    Thank you all for the answers you guys offered. i think i will end up using this code.
    #!/usr/bin/perl use warnings; %alex = ( 'name' => 'Alex', 'age' => '45'); %john = ( 'name' => 'John', 'age' => '20'); %chaddy = ( 'name' => 'Chady', 'age' => '16'); @children = (\%john, \%chaddy); $alex{'children'} = \@children; print "Alex children are \n " , join("\nand ", map $_->{age}, reverse @{$alex{children}}) , "\tyears old\n"; print "Alex is $alex{age} himself\n";
    instead of the one i mentioned above. much easier to understand i guess,thx Roy and thank you all once again.