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:

if ($stripped =~ /\.(\w+)\s+(\w*)$/) { ($cmd, $parameter) = ($1, $2); # Other stuff.... }
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.

HTH

Replies are listed 'Best First'.
Re: Re: Parsing
by Jaspersan (Beadle) on Jun 11, 2002 at 15:45 UTC
    I was thinking about using regex, but havnt read much about it. Thanks for the help.
    p.s: ive never touched C :P
    ^jasper <jasper@wintermarket.org>