in reply to Data::Dumper is not quite what I want.
First, recursively walk through the hash, and use the new version of Storable to serialize all code-references. Now you can use Data::Dumper to dump the hash. Easy.
use Storable qw(freeze thaw); sub rec_walk { my $hash = shift; foreach (keys %$hash) { if (ref $hash->{$_} eq 'CODE') { $hash->{$_} = freeze $hash->{$_} } elsif (ref $hash->{$_} eq 'HASH') { $hash->{$_} = rec_walk($hash->{$_}) } } $hash } my %hash = (...); print Dumper rec_walk(\%hash);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Data::Dumper is not quite what I want.
by diotalevi (Canon) on Dec 27, 2002 at 05:41 UTC |