Oh, I notice you wanted a hash, well I'm sure you can figure it out :)#!/usr/local/bin/perl -l -w use Data::Dumper; my @arr = map {my $var=$_; [$_, sub {$var}]} qw(a b c); print Dumper(\@arr); print &{$arr[0][1]}; print &{$arr[1][1]};
In reply to Re: closure question
by runrig
in thread closure question
by nop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |