perl hash of hashes from database

hi there, I have some database output that looks like this

SELECT nic_name,nic_duplex,nic_speed,nic_ip FROM network_table WHERE hostname = "server1"

result is this (ive delimited with a pipe for ease of reading)

bge0|full|1000|10.32.100.1
bge1|full|1000|11.12.101.7 
bge2|full|100|13.12.10.17

Now, i know how to create a hash of hashes manually from this data, and it works just fine, see below

#!/opt/coolstack/bin/perl
  %HoH = (     
       bge0 => {         
                      nic_speed   => "full",
                      nic_duplex  => "1000", 
                      nic_ip      => "10.32.100.1",   
                   },     
       bge1 => {        
                      nic_speed   => "full",
                      nic_duplex  => "1000",      
                      nic_ip      => "11.12.101.7",    
                   },    
       bge2 => {         
                      nic_speed   => "full",       
                      nic_duplex  => "100",        
                      nic_ip      => "13.12.10.17",   
                   }, 
            );

however, can somebody advise me how I would get this hash of hashes auto-generated straight from the database using DBI ? currently all I have is

#!/opt/coolstack/bin/perl

use DBI; 
$box = "server1";  
my $dbh = DBI->connect("DBI:mysql:CMDB",root,password,) or die $DBI::errstr; 

my $sth = $dbh->prepare("SELECT nic_name,nic_duplex,nic_speed,nic_ip FROM network_table WHERE hostname = '$box'") or die $DBI::errstr;  

$sth->execute or die $DBI::errstr; 

while (my $hashr = $sth->fetchrow_hashref) { 

}

but i really dont know how I can self populate my hash of hashes directly from the SELECT statement which produces the table above..somebody suggested using fetchrow_hashref hence why i have added it in the line above, but it doesnt seem to do what i want

Any help or guidance on this would be greatly appreciated ( i am very new to perl)

You want fetchall_hashref I think.

DBI - Database independent interface for Perl - search.cpan.org