Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Traverse an unknown multi-dimensional hash

by Anonymous Monk
on Jul 28, 2012 at 22:37 UTC ( #984247=note: print w/replies, xml ) Need Help??


in reply to Re^3: Traverse an unknown multi-dimensional hash
in thread Traverse an unknown multi-dimensional hash

ub dumpHash { my ($element, $indent) = @_; $indent ||= ''; return " = $indent$element\n" unless 'HASH' eq ref $element; my $str= ''; for my $key (sort keys %$element) { $str .= "$indent$key :"; $str .= dumpHash ($element->{$key}, $indent . ' '); } return $str;
output :
toplevel-1 : sublevel1a : = value-1a sublevel1b : = value-1b toplevel-2 : sublevel1c : value-1c.1 : = replace +ment-1c.1 value-1c.2 : = replacement-1c.2 sublevel1d : = value-1d
but i want
toplevel-1 : sublevel1a : = value-1a toplevel-1 : sublevel1b : = value-1b

Replies are listed 'Best First'.
Re^5: Traverse an unknown multi-dimensional hash
by Anonymous Monk on Jul 30, 2012 at 04:36 UTC
    Yes, I understand by now that you're trying to get rid of newlines, that is great, but where is your modification of dumpHash, with code tags, where you try?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://984247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2022-01-28 01:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (72 votes). Check out past polls.

    Notices?