wfbojar has asked for the wisdom of the Perl Monks concerning the following question:
First:
I need to split up a string on white space:
$var = "1 word here another word";
the "1 word here" needs to be split from "another word". I've tried several things with switch and split but nothing works. Also, once they are split up, how do I remove the white space either before or after the values. For example:
"1 word here " down to "1 word here" and
" another word" down to "another word"
Second:
I need to evaluate the first two positions of a string to see if they're numeric. I cannot remember how to specify to only look at certain positions in a string and nothing else. How is that done?
Thanks in advance for your help.
You guys rock!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split and Pattern Match
by particle (Vicar) on Jun 06, 2003 at 15:47 UTC | |
|
Re: Split and Pattern Match
by broquaint (Abbot) on Jun 06, 2003 at 15:46 UTC | |
|
Re: Split and Pattern Match
by hardburn (Abbot) on Jun 06, 2003 at 15:43 UTC | |
|
Re: Split and Pattern Match
by djantzen (Priest) on Jun 06, 2003 at 15:54 UTC | |
|
Re: Split and Pattern Match
by wfbojar (Initiate) on Jun 06, 2003 at 16:29 UTC |