note
BrowserUk
<p>Even with [jeffa]'s notes below, it still took me a while to wrap this around my brain but when I had, I came up with this....
<p><code>
my @array = qw /a b c d e f/;
my $hash;
my $val = 1;
($hash->{pop @array}, $val, $hash) = ($val, $hash, undef) while @array;
$hash = $val;
</code>
<p>Which is slightly cleaner?, but that final assignment stood out so...
<p><code>
my @array = qw /a b c d e f/;
my $hash = 1;
my $tmp;
($tmp->{pop @array}, $hash, $tmp) = ($hash, $tmp, undef) while @array;
</code>
<p>Slightly non-intuative to assign the value to the hashref at the start but...
189833
189843