my @array = (1..20); my $i = 0; for (@array) { print "$_\n"; last if ++$i >= 10; }