Use map to filter values
I am not sure why would you do this instead of using grep
, but you can do this and this can bring use to another,
more usefule example.
#!/usr/bin/perl
use strict;
use warnings;
my @numbers = (1, 4, 17, 3, 28, 4);
my @big_numbers = map {$_ >= 10 ? $_ : ()} @numbers;
print "@big_numbers\n"; # 17 28