%calls = &call_type( $d, $d ); sub call_type { #FIELD NAMES (name, calltype, calls, minutes, revenue, cost, margin) my ( $name, $calltype, $calls, $minutes, $revenue, $cost, $margin, %calls ); my ( $day_start, $day_end ) = @_; my $sp = $msdbh->prepare( qq|usp_Dashboard_CallType \@start = '$day_start', \@end = '$day_end'|); $sp->execute or die( $sp->errstr ); while ( ( $name, $calltype, $calls, $minutes, $revenue, $cost, $margin ) = $sp->fetchrow() ) { $calls{ $day_start . ":" . $name } = [ "$calltype", "$calls", "$minutes", "$revenue", "$cost", "$margin" ]; } return %calls; }