use strict; use warnings; use DBI; use Data::Dumper; my $dbd = "mysql"; my $host = "localhost"; my $db_name = "m5"; my $user = "foo"; my $password = "bar"; my $dsn = "DBI:$dbd:$db_name:$host"; my $dbh = undef; sub open_db_conn { $dbh = DBI->connect( $dsn, $user, $password, { RaiseError => 1, AutoCommit => 0 } ); print "Could not open database connection: $@" if $@; } sub call_proc4 { my $sth = $dbh->prepare( qq{ call proc4() } ) or die(q{prepare failed!}); $sth->execute() or die(q{execute failed!}); while (my $href = $sth->fetchrow_hashref()) { print Dumper($href); } $sth->finish(); } # ------ main ------ open_db_conn(); my @active_homes = call_proc4(); $dbh->disconnect(); __END__ $ perl 621223.pl $VAR1 = { 'TWO' => '4', 'THREE' => '7', 'ONE' => '1' }; $VAR1 = { 'TWO' => '5', 'THREE' => '8', 'ONE' => '2' }; $VAR1 = { 'TWO' => '6', 'THREE' => '9', 'ONE' => '3' };