Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Okay, I have an extremely foolish question on the uses of split. I have a string, lets call it $string. $string contains words seperated by an indeterminate amount of whitespace. I need to grab a few values out of the array like so
($valone, $valtwo, $valthree) = split( some regex, $string);
Currently I am using the regex /\s+/g. But this doesn't seem to work. $valthree gets what should be in $valtwo, $valtwo what should be in $valone, and $valone is left blank. I know that $string may or may not have leading whitespace.
If anyone could point out what I am doing wrong, it would be appreciated.
JAsomewhatembarrassedPH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uses of split
by jptxs (Curate) on Nov 02, 2000 at 00:17 UTC | |
|
(tye)Re: uses of split
by tye (Sage) on Nov 02, 2000 at 00:39 UTC | |
|
(jeffa) Re: uses of split
by jeffa (Bishop) on Nov 02, 2000 at 00:16 UTC |