my $get_username = sub { my ($stmt, @bind) = $sql->select('tbl', 'username', { id => shift }); return $dbh->selectrow_array($stmt, undef, @bind); } print $get_username->($id),"\n";