in reply to Printing Hashes (Without Data Dumper)
#! perl -sw use strict; my %hash = ( I => 1 , II => { A=> 3 , B=> { 1=> 4, 2=> 5, 3=> 6 } } , III=> 2 ); sub hprint{ return "$_[1] => $_[0]\n" unless ref $_[0]; print for map { hprint( $_[0]{$_}, "$_[1]/$_" ) } keys %{ $_[0] }; (); } hprint \%hash, 'hash'; __END__ D:\Perl\test>test hash/II/B/1 => 4 hash/II/B/2 => 5 hash/II/B/3 => 6 hash/II/A => 3 hash/I => 1 hash/III => 2
|
|---|