use warnings; use strict; my @l = qw/10 20 30/; #my $t += $_ foreach @l; my $t; $t += $_ foreach @l; print $t;