use strict; use warnings; my $x = 12; foreach my $aa ($x,$x){ $aa = 13; } print $x; ---------- 13