#!/usr/bin/perl use strict; use warnings; $_ = 123; while( m/\d/g ) { print "I saw [$&]\n"; redo if $& == 1; last; }