use strict; use warnings; use 5.010; $_ = '79899920179'; my $pass = qr/(?=)/; my $fail = qr/(*FAIL)/; while (/\G(\d{2,}?)(??{ $1 >= 32 ? $pass : $fail })/g) { say $1; } #### $ perl6 -e 'say "79899920179".comb(/ (\d **? 2..*) = 32 }>/)' 79 89 99 201 79