in reply to Parsing small string
You don't have to inch along the string (you're used to programming in C, right? ;-) If the command and optional parameter are alphanumeric, just do this:
In general, if you want to take a string apart in Perl, regexes are much easier. More info at perlop (look for "quote-like operators") and perlre.if ($stripped =~ /\.(\w+)\s+(\w*)$/) { ($cmd, $parameter) = ($1, $2); # Other stuff.... }
HTH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parsing
by Jaspersan (Beadle) on Jun 11, 2002 at 15:45 UTC |