in reply to Defining an anonymous hash with slices and lists.

The following is quite ugly and either the keys or the values need to be typed in twice, but I just couldn't get closer to the solution (if there is one):
#!perl use strict; use warnings; foreach my $val ( qw/ one one three two one / ) { print scalar { map { @{[(qw/one two three/, reverse (1..3))]}[$_ - 1, -$ +_] } (1..(2 * @{[1..3]})) }->{$val}, "\n"; }
or just typed in once, but with one additional variable used within the outer map
#!perl use strict; use warnings; foreach my $val ( qw/ one one three two one / ) { print scalar { map { my $intern = $_; map { @{$intern}[$_ - 1, -$_] } (1..@{$_}) } ([(qw/one two three/, reverse (1..3))]) }->{$val}, "\n"; }
I could of course (ab)use an internal variable, but it remains another variable. Anyone have an idea?
Cheers, CombatSquirrel.
Entropy is the tendency of everything going to hell.