in reply to Regexp - groupings

The split with parenthesis: () captures the elements within. You might perhaps be able to better appreciate the difference by looking at an alternate form of the same expression and operation as given below: (please notice the presence and absence of () in the split commands.
#!/usr/bin/perl use strict; use warnings; my $x = '12aba34ba5'; my @num = split/[a-b,A-Z]/, $x; print "$num[$_],\n" foreach (0..$#num); print"-------\n"; @num = split/([a-b,A-Z])/, $x; print "$num[$_],\n" foreach (0..$#num);
Update: the (?:) makes sure that this is not captured so if you try out:
@num = split/(?:[a-b,A-Z])/, $x; print "$num[$_],\n" foreach (0..$#num);
it will spit out the same output as:
@num = split/[a-b,A-Z]/, $x; print "$num[$_],\n" foreach (0..$#num);
(apologies for the length of this reply).