perldoc -f split

Will fic you up!

Dmuey

> Hi Guys,
> 
> I have an array in which each element is a line commandline 
> data.  It looks something like this -
> 
> @Array contains lines:
> 
> post1: -r [EMAIL PROTECTED] -x cat-100 -h post1
> post2: -x tel -h post2
> post3: -h post3 -x hifi
> 
> And so on.  The order of the options varies, and there may or 
> may not be a 
> -r $arg on the line.
> 
> These lines are parsed from a file with more lines, of which 
> I extracted all the lines with -h:
> 
> open (F, "<$File");
> 
> while (<F>) {
>    if ($_ =~ / -h /) {
>       # remove crud
>       s/ \"\|//;
>       s/\/some\/crud\/path argument //;
>       s/\"$//;
>       # store what's left
>       push @Array, $_;
>    }
> }
> 
> What I really need to do is build a relationship between the 
> first field 
> (which is the same as the argument to -h) and the argument to 
> -x.  The -x flag can be dropped, as they're not needed.
> 
> So it looks like I need to build a hash based. 
> 
> But I can't can't grok how to parse each line out to do what 
> I need, then move on to the next line (all lines are 
> unrelated to each other).
> 
> I've been using shift, but then I'm doing something like, 
> (psuedo code):
> 
> if ($_[0] eq "-r") { $r = (shift);}
> 
> but if sub 0 doesn't eq -r, and I shift until I get to -x, 
> say, and use that for the $x = (shift), how can I be 
> efficient to check again for -r, which I still haven't found?
> 
> Is this making any sense?
> 
> Thanks,
> 
> deb
> 
> 
> 
> -- 
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> =-=-=-=-=-=-=-=-=-
>           There are 010 types of people in the world:
>        those who understand binary, and those who don't.
> τΏτ   111,111,111 x 111,111,111 = 12,345,678,987,654,321 (decimal)
>  ~ 
> 
> 
> 
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to