my $hash; while(my $r = $sth->fetchrow_hashref) { $hash->{$r->{'var'}} = sub { $r->{'mod'}->$r->{'sub'}($r->{'params'}); } }