I have this hash and this array, and execute the following command...
hash={"a"=>1,"b"=>2,"c"=>3,"d"=>4,"e"=>5,"f"=>6}
array=["b","a","c","f","z","q"]
print hash.values_at(*array).compact
So I want it to return something like:
#=> [2,1,3,6,"invalid","invalid"]
Is there a way to declare all other elements non-existent in the hash as "invalid", without declaring one by one (e.g. "g"=>"invalid", "h"=>"invalid"...)?