use strict; use warnings; my $x; for $x (1 .. 3) { last if $x == 2 } print $x;