Hi Joe,

just to correct my prevoius one,  my $line does not have * in the begining,
that was a type.  the $line value is like this

*Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m*



my grep return the values correct to my array and the values in array will
be like this obviously:

*Options=-a"hello" -mt -ml3 *
*"dir1\dir2"-k -p *
*"dir3\dir4" -m*
**
**
But, what I'm interested in getting the output values are:
*"dir1\dir2"*
*"dir3\dir4"*

I do not know how to get them......can u suggest pls.?


thanks
Umesh
**

**
**






On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
>
> Umesh T G am Donnerstag, 15. Dezember 2005 14.20:
> > Hi John,
>
> Hi Umesh
>
> > I tried like this,   where $line='*Options=-a"hello" -mt -ml3
> -i"dir1\dir2"
> > -k -p -i"dir3\dir4" -m'*
> >
> >
> >
> > if (grep/^Options/,$line)
> > {
> >
> > @inc=split(/-i/,$line);
> >
> > foreach $word (@inc)
> > {
> > print "$word\n";
> > }
> >
> >
> >
> > I do not know how to proceed after this.....
> > Thanks for your quick reply...
>
> You're welcome...
>
> try the following:
>
> a) put
>   use strict;
>   use warnings;
> at the beginning of the script
>
> b) look at the warnings and then declare the vars with my, see
> perldoc -f my
>
> c)
> read the documentation
> perldoc -f grep
> to see why grep is not appropriate in the if clause
>
> d) check the documentation
> perldoc -f perlre
> and the others mentioned at the bottom to see why
> /^Options/ won't ever match a string beginning with '*' and why your
> script
> doesn't print anything
>
> e) hint:
> don't use if, only use a regex to extract the parts you like, and extract
> them
> directly  into an array by catching the parts you like
>
> ... and post the new code then :-)
>
> greetings joe
>
>
>
> >
> >
> >
> > Thanks
> > Umesh
> >
> > On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > > > Hi List,
> > >
> > > Hi Umesh
> > >
> > > > I want to get that value of *-i* set in below line.
> > > >
> > > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*
> > > >
> > > > What is the best way to get the value of *-i* values into one
> > >
> > > array.  For
> > >
> > > > ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into one
> > >
> > > array.
> > >
> > > What possibilities did you try (show us some code), from which the
> best
> > > could be choosed, or to which a better could be added?
> > >
> > > joe
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>

Reply via email to