- or download this
my @a = map { transformation($_) } @b;
# same as
my @a;
push @a, tranformation($_) for @b;
@a
- or download this
my @a = grep { condition($_) } @b;
# same as
...
push @b, $_ if condition($_);
}
@a
- or download this
my @even = grep $_ % 2 == 0, @numbers;
my @odd = map $_ * 2 +1, @numbers;
- or download this
my @numbers = grep /^[0-9]+$/, @words;