$_ = 'abcd'; if (my @matches = /(.)(.)/) { for my $i (0, 1) { print "$i: $matches[$i]\n"; } }