in reply to RegEx Doubt
Update:$ perl -e '@a = split /<\/?xyz>/, q(<xyz>a</xyz><xyz>a3</xyz><xyz>a2</ +xyz><xyz>a1</xyz>); print qq/@a\n/' a a3 a2 a1
Ahhh, maybe I see one reason, using Data::Dumper to print the output gives:
Question, for me at least is: why doesn't split swallow the sub-strings on which the string is split ? I'm obviously missing something, but can't see it - any enlightenment appreciated.$ perl -MData::Dumper -e '@a = split /\<\/?xyz\>/, q(<xyz>a</xyz><xyz> +a3</xyz><xyz>a2</xyz><xyz>a1</xyz>); print Dumper \@a' $VAR1 = [ '', 'a', '', 'a3', '', 'a2', '', 'a1' ];
TIA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RegEx Doubt
by jakobi (Pilgrim) on Sep 30, 2009 at 12:22 UTC | |
by Bloodnok (Vicar) on Sep 30, 2009 at 12:28 UTC | |
|
Re^2: RegEx Doubt
by grizzley (Chaplain) on Oct 01, 2009 at 07:39 UTC | |
|
Re^2: RegEx Doubt
by dsheroh (Monsignor) on Oct 01, 2009 at 07:41 UTC |