in reply to Passing hash to package sub and get it returned ..
use strict; use warnings; my $hash = test::this(); for my $box (keys %{$hash}){ print "this is box $box\n"; for my $par (keys %{$$hash{$box}}){ print "this is partition $par\n"; # for my $sec (keys %{$hash->{$box}->{$par}}){ # print "this is section $sec\n"; # } } } package test; sub this { my $Dbox = "Dbox"; my $DDD = "DDD"; my %temp; $temp{"Dbox"}{$DDD}= "DDD"; for my $box (keys %temp){ print "this is box $box\n"; for my $par (keys %{$temp{$box}}){ print "this is partition $par\n"; # for my $sec (keys %{$temp{$box}->{$par}}){ # print "this is section $sec\n"; # } } } return \%temp; }
|
|---|