Getting actual value of array
perl
Solution
Use an array slice with `grep()` to produce a list of indices.
my @array = qw(a b c d e f g);
my @list = @array[ grep { $_ % 2 } 0 .. $#array ];
Problem
I have searched for examples of returning even and odd elements of an array in Perl and came across some examples using map and grep. ``` @array = ('a', 'b', 'c', 'd', 'e', 'f', 'g'); @list = grep {$_ % 2} 0..$#array; ``` I have tried to return `b, d, f` from the given array but it's just returning numbers and not the actual value. How can I get the actual values back?