use strict; my @array = (1, 2, 3); my $item = 'z'; foreach $item (@array) {} print($item); # Prints 'z' (not '3'!!!).