CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [jeffersno1] perl script to gather dbtable size and memory: Edit Log



Laurent_R
Veteran / Moderator

Jul 15, 2013, 5:22 AM


Views: 1505
Re: [jeffersno1] perl script to gather dbtable size and memory

Hi,

not sure what exactly you want to print, but this should put you on the right track.



Code
 for my $lev1 ( keys %db_hash) { 
for my $lev2 (keys %{$db_hash{$lev1}}) {
for my $lev3 (keys %{$db_hash{$lev1}{$lev2}}) {
print "$lev3 : $db_hash{$lev1}{$lev2}{$lev3} \n";
}
}
}


Which should print:


Code
memory :  6958211 
size : 107014
memory : 3808418
size : 48610


or else, if you find it clearer, you can build progressively your approach:

Code
my @lev1 = keys %db_hash; 
my @lev2 = keys %{$db_hash{$lev1[0]}};
# ...



(This post was edited by Laurent_R on Jul 15, 2013, 5:43 AM)


Edit Log:
Post edited by Laurent_R (Veteran) on Jul 15, 2013, 5:43 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives