in reply to A quesion about referencing lists
Constructions like that can often be simplified by slices or by map. In the case of @years and @years_loop in the last example, the for(){push} construction is unnecessary. You already have a list of that data in the parens - just assign it directly. @years_loop is then an easy map,
The inner pair of curlies in the map produce a reference to an anonymous hash without needing to give it any temporary name.my $curr_year = (localtime)[5] + 1900; my @years = $cur_year - 100 .. $cur_year - 5; my @years_loop = map { { year => $_ } } @years; $template->param(years_loop => \@years_loop);
After Compline,
Zaxo
|
|---|