use v5.14; use warnings; say "INPUT: ",my $str = join " ", 11 .. 19; my @matches = $str =~ m/(\d+) (\d+)/g ; while (my ($c,$r) = splice @matches,0,2) { say "$c - $r"; }