in reply to quickly create reference to boring hash.
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.
|
|---|