MeowChow has asked for the wisdom of the Perl Monks concerning the following question:
What's going on with the second split? Is this a boundary condition bug^H^H^Hfeature in Perl, or is this migrane clouding my better judgement? Your prescriptions are very much appreciated.$string = "a:b:c"; ($line) = split /:/, $string, 0; print "Split zero times - $line\n"; ($line) = split /:/, $string, 1; print "Split one time - $line\n"; ($line) = split /:/, $string, 2; print "Split two times - $line\n"; outputs: Split zero times - a Split one time - a:b:c Split two times - a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A split ing headache
by extremely (Priest) on Dec 12, 2000 at 09:41 UTC | |
|
(take two...) Re: A split ing headache
by mwp (Hermit) on Dec 12, 2000 at 12:28 UTC | |
by extremely (Priest) on Dec 12, 2000 at 14:19 UTC | |
by japhy (Canon) on Dec 12, 2000 at 19:37 UTC | |
by extremely (Priest) on Dec 13, 2000 at 09:05 UTC | |
|
Re: A split ing headache
by tilly (Archbishop) on Dec 12, 2000 at 09:11 UTC |