in reply to Re: Variables in variable names
in thread [untitled node, ID 216639]
Like the nested hash solution($matrix{'a'}{2} = 5;), it lets you use non-numeric indices but uses a little less memory. You can loop through it like so:$matrix{'a,4'} = 20; $matrix{'b,5'} = 30;
for my $x ('a'..'g') { for my $y (1..6) { my $val = $matrix{"$x,$y"}; ... } }
|
|---|