Ruby - How to use an array value as the key in a hash lookup
<p>I am trying to output a string text in which I use a value from a hash (lookup). The hash key is in the input array.</p>

<p>The desired outcome would be "Hello John" but the approach I am taking is not working. Any suggestions to correct this?</p>

<pre><code>input = [44,55]
lookup = { 44 =&gt; "Dave", 55 =&gt; "John" }
puts "Hello #{lookup[input[1]]}"
</code></pre>