John wrote:
> Did you try the code I posted Friday?  (Message-ID: <[EMAIL PROTECTED]>) 

John,

Thanks, yes, I did.  But, the syntax was new to me, and I've been reading
up on it.  I couldn't really get it to do what I want (see my previous
post to this one).  But, that's probably b/c I didn't explain very 
well.  I hope I explained more completely in my posting just previous
to this one.

Thanks,

deb

John W. Krahn <[EMAIL PROTECTED]> had this to say,

> Deb wrote:
> > 
> > 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.
> 
> If you want to put the data into a hash this may do what you want:
> 
> $ perl -le'
> @array = (
>     "post1: -r [EMAIL PROTECTED] -x cat-100 -h post1",
>     "post2: -x tel -h post2",
>     "post3: -h post3 -x hifi"
>     );
> for ( @array ) {
>   %hash = /(-[a-z])\s*((?!-)\S*)/g;
>   $" = " <*> ";
>   print "*> @{[%hash]} <*";
>   }'
> *> -r <*> [EMAIL PROTECTED] <*> -h <*> post1 <*> -x <*> cat-100 <*
> *> -h <*> post2 <*> -x <*> tel <*
> *> -h <*> post3 <*> -x <*> hifi <*
> 
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
          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]

Reply via email to