##
INPUT: 11 12 13 14 15 16 17 18 19
11 - 12
13 - 14
15 - 16
17 - 18
####
use v5.14;
use warnings;
say "INPUT: ",my $str = join " ", 1..9;
my $stop=5;
while ( my ($c,$r) = ($str =~ m/(\d+) (\d)/gc) ) {
say "$c $r";
die unless $stop--;
}
####
INPUT: 1 2 3 4 5 6 7 8 9
1 2