- or download this
my @foo = (2, 4, 8);
foreach my $num (@foo) {
$num *= 2;
}
$, = ",";print @foo;print "\n";
- or download this
my @foo = (2, 4, 8);
foreach my $num (@foo) {
...
$_[0] = 2*$_[0];
return $_[0];
}
- or download this
sub double {
my $num = $_[0];
$num = 2*$num;
return $num;
}