my $sequence = '12345'; if( index($sequence, '1') >= 0 ) { # found the 1 digit. Interrupt here. }