Hi list Can anybody please explaing the meaning of the following regular expression
my $x = '12abc34bf5'; @num = split /(a|b)+/, $x; print "NUM=@num\n"; NUM=12 b c34 b f5 Does it mean split the string ,here separaters are 'a' or 'b'(one or more occurance because of + metacharacter). If it matches from left i.e. a comes before b in the $x then why I am getting 'b' as the 4th element in @num? changing the split statement produces same result why? my @num = split /(b|a)+/, $x print "NUM=@num\n"; OUTPUT: NUM=12 b c34 b f5 also I need the explanation of the output because. I cant understand that if split function splits the string based on separater 'a' then I should get bc34bf5 as second element. But the non capturing grouping works as fine and I can understand it easily. my $x = '12abc34bf5'; @num = split /(?:a|b)+/, $x; print "NUM=@num\n"; NUM=12 c34 f5 split on either 'a' or 'b' but dont capture 'a' or 'b' Thanks & Regards in advance Anirban. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/