8.23. map

Example 8-17. examples/arrays/map_perl.pl

#!/usr/bin/perl
use strict;
use warnings;

my @numbers = (1..30);
my @doubles = map {$_ * 2} @numbers;

foreach my $num (@doubles) {
    print "$num\n";
}

If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed