I am trying to follow advice here that suggests map and grep rather than
foreach where possible. Currently I use foreach to find the rank of a
particular hashref in a sorted array. How could I make the grep below
work? ($rank_in_sorted_array) = grep $_->{my_target} @sorted_array;