fork download
  1. sub print_hash
  2. {
  3. my ( $prefix, $href ) = @_;
  4.  
  5. while ( my ( $key, $val ) = each %$href )
  6. {
  7. if ( ref $val )
  8. {
  9. print_hash( "$prefix$key\t", $val );
  10. }
  11. else
  12. {
  13. print "$prefix$key\t$val\n";
  14. }
  15. }
  16. }
  17.  
  18. my %hh = (
  19. key1 => {
  20. key2 => 'abc',
  21. key3 => {
  22. keymany => 'value'
  23. }
  24. },
  25. key11 => {
  26. key22 => 'def',
  27. }
  28. );
  29.  
  30. print_hash( "", \%hh );
  31.  
  32. exit 0;
Success #stdin #stdout 0s 4552KB
stdin
Standard input is empty
stdout
key1	key2	abc
key1	key3	keymany	value
key11	key22	def