in reply to Re^2: from array to hash
in thread from array to hash

In that case, you can use a loop instead:

$b{$_} = 1 for grep defined, @a;