#!/usr/bin/perl use strict; use warnings; for( my $i = 1; $i =~ m/\d/; $i++) { print "I saw [$i]\n"; redo if $& == 5; last if $i == 10; }