I have an array of hashes:
my @sports;
push @sports, { id=>1, name=>'Rugby' };
push @sports, { id=>2, name=>'Football' };
and I want to get an array of all the names (to display in a CGI popup menu). I tried using this grep statement:
my @names = grep { $_->{name} } @sports;
but it just returns an array of hash values...
So I am currently resorting to using a loop to iterate through all the values, pushing them into another array.
Is there a way to speed this up?