binesh_28 has asked for the wisdom of the Perl Monks concerning the following question:
I have a bit of confusion understanding the result from using a split function with '+' operator
Here's my code. @fields =split /(a|b)+/, "a12cdabab"; for my $val(@fields) { print "Value:$val\n"; }
This prints the answer as : Value: Value:a Value:12cd Value:b Can someone please explain how perl produces this output?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split operator in perl
by BrowserUk (Patriarch) on Dec 06, 2010 at 06:22 UTC | |
|
Re: Split operator in perl
by ikegami (Patriarch) on Dec 06, 2010 at 06:11 UTC | |
by binesh_28 (Initiate) on Dec 06, 2010 at 07:58 UTC | |
by ikegami (Patriarch) on Dec 06, 2010 at 16:23 UTC | |
|
Re: Split operator in perl
by perl_lover (Chaplain) on Dec 06, 2010 at 06:20 UTC | |
|
Re: Split operator in perl
by suhailck (Friar) on Dec 06, 2010 at 06:21 UTC |