#!/bin/perl5 use strict; use warnings; my $v = { 'comp1' => { 'cmd2' => [ [ 'test2', 'type1', 'view1' ] ], 'cmd1' => [ [ 'test1', 'type1', 'view1' ], [ 'test2', 'type1', 'view1' ] ] } }; for my $k1 (sort keys %{$v}){ print "$k1\n"; for my $k2 (sort keys %{$v->{$k1}}){ print " $k2\n"; for my $a1 (@{$v->{$k1}{$k2}}){ for my $a2 (@{$a1}){ print " $a2\n"; } print "-" x 20, "\n"; } } } __DATA__ ---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl comp1 cmd2 test2 type1 view1 -------------------- cmd1 test1 type1 view1 -------------------- test2 type1 view1 -------------------- > Terminated with exit code 0.