sub collect (&@) { collect( $_[0]->() || return @_[1 .. $#_] ) } my @results = collect { $sth->fetchrow_hashref };