in reply to Re^2: Converting some MapReduce PHP scripts to Perl
in thread Converting some MapReduce PHP scripts to Perl

As you mentioned, the data contains an array and a hash, it needs more than just a print ... I'm sure there are many ways to do it but here is what i have ...
foreach my $key ( keys %data ) { my $out = ''; foreach my $s ( @{ $data{$key}} ) { if ( ref $s eq 'ARRAY' ) { $out .= '[' . ( join ',', @$s ) . ']'; } else { while ( my ($k,$v) = each %$s ) { $out .= ",{\"$k\":$v}"; } } } print $key . "\t[$out]\n"; }