title: Create a multidimesional key of hash from array?
body: <p>I want to create a multidimensional <code>%hash</code> from the <code>@array</code>.</p>
  
  <p>Suppose <code>@array</code> is like </p>
  
  <pre><code>my @array=(1,2,3,4,5);
  </code></pre>
  
  <p>I want to assign <code>@array</code> last value as final value to multidimensional <code>%hash</code> i.e </p>
  
  <pre><code>%hash=(
          1=&gt;{ 
                2=&gt;
                   {
                    3=&gt;
                        {
                          4=&gt;5
                         }
                    }
                }
             )
  </code></pre>
  
  <p>Which means <code>$hash{1}{2}{3}{4}=5;</code></p>
  
  <p>I want to do it in something like:</p>
  
  <pre><code>for my $i (0..$#array){
      #push $i as key until second last element and assign last element as value
  } 
  </code></pre>
  
  <p>Note : The <code>@array</code> may be of any size, Just I want to assign last element of <code>@array</code> as value to the keys of elements before the last element in <code>%hash</code>.</p>