in reply to Assigning AoH pairs by value other AoH's

my $template->param( men => [ grep { $_->{gender} eq 'M' } @$AoH ], women => [ grep { $_->{gender} eq 'F' } @$AoH ], );

Given the phrasing of the question, I think this maps very closely to the way you are asking the question. Granted, it scans through your @$AoH twice, which makes it a little less efficient than other methods, but it does map very closely to the way you are thinking of your problem by what you asked.

Replies are listed 'Best First'.
Re^2: Assigning AoH pairs by value other AoH's
by bradcathey (Prior) on Sep 10, 2005 at 18:25 UTC

    Took this route because in practice the actually script was more complicated than my example. It worked great. I appreciate the example of using grep within $template->param. Another trick in my bag.


    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot