Is there a way to do this without the intermediate %hash variable?
my %hash = map {$_ => ['id_1']} @array; my $hashref = \%hash;
can be written as
my $hashref = { map {$_ => ['id_1']} @array };
Curlies create a hash, initialize it with the list in the curlies, and returns a reference to the new hash.
In reply to Re: quickly create reference to boring hash.
by ikegami
in thread quickly create reference to boring hash.
by tford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |