Use map to filter and enrich



examples/advanced-perl/map_filter_and_enrich.pl
#!/usr/bin/perl
use strict;
use warnings;

my @numbers = (1..5);

my @riches = map { $_ > 3 ? ($_+1, $_+2) : () } @numbers;
print "@riches\n"; # 5 6 6 7