in reply to Hash slice to get DB values - include undefined values?

I only know how to do what you're asking in 2 steps. I usualy do something similar to:
$g{$_} ||= undef for @cols; my @vals = @g{@cols};
I'd stick with undef since you're using a database. IIRC, undef translates to NULL to indicate the absence of a value, while 0 is a value.