in reply to Regexp - groupings
Update: the (?:) makes sure that this is not captured so if you try out:#!/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);
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).@num = split/[a-b,A-Z]/, $x; print "$num[$_],\n" foreach (0..$#num);
|
|---|