#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $struct={a=>[{a=>[1,2,3,4],b=>{a=>1,b=>2,d=>3}},{a=>1,b=>2},[1,2,3],[1,2]],b=>{a=>{a=>[1,2,3,4],b=>0},b=>[1,2,3,4,5,6,7]},c=>10}; sub catch { my $in=shift; my $ref=shift; my $type=ref($ref); if($type eq 'HASH') { for my $key (keys(%$ref)) { catch("$in HASH($key)->",$ref->{$key}); } } elsif($type eq 'ARRAY') { for my $i (0..$#$ref) { catch("$in ARRAY($i)->",$ref->[$i]); } } else { print "$in VALUE=$ref\n"; } } print Dumper($struct); catch("",$struct);