programming-examples/perl/Array/double each element of an array.pl
2019-11-15 12:59:38 +01:00

7 lines
151 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
my @array=(10, 20, 30, 40);
print "Before: @array\n";
for (@array) { $_ *= 2 }
print "After: @array\n";