Jaspersan has asked for the wisdom of the Perl Monks concerning the following question:
This works just fine, but when I try to check if there is no parameter (I know it has to do with the chr(32), since there would be no space if it was only a command :P), but all the attempts to check for this have failed. I've tried checking to see it $cmd_locend == -1, etc.#!/usr/bin/perl #get command portion of data use strict; my ($stripped,$cmd,$cmd_loc,$cmd_locend); $stripped = ".command parameter"; $cmd_loc=index($stripped,"."); $cmd_locend=index($stripped,chr(32)); $cmd=substr($stripped,$cmd_loc,$cmd_locend++); print $cmd."\n";
Title edit by tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing
by VSarkiss (Monsignor) on Jun 11, 2002 at 15:10 UTC | |
by Jaspersan (Beadle) on Jun 11, 2002 at 15:45 UTC | |
|
Re: Parsing
by Joost (Canon) on Jun 11, 2002 at 15:09 UTC | |
|
Re: Parsing
by Jaspersan (Beadle) on Jun 11, 2002 at 15:05 UTC |