Connie Chan wrote:

> Strange ...
>
> my ($row, $col) = /(\d+)/g;
> Can get the value.
>
> but
> my ($row, $col) =~ /(\d+)/g;
> will get , only.
>
> Why ?
>
> Besides, that's really that mine one on the last post
> doesn't work. but what's the problem ?
>
> Anyway, here is a stupid update for my approach.
>
> my ($row, $col) = ($1, $2) if ( /^[^\d]+(\d+)[^\d]+(\d+)$/);
>
> but of cause :
>
> ($row, $col) = /(\d+)/g ; # is much much better.
>
> Rgds,
> Connie
>
> ----- Original Message -----
> From: "Nikola Janceski" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "Connie Chan" <[EMAIL PROTECTED]>; "Beginners Perl" 
><[EMAIL PROTECTED]>
> Sent: Saturday, August 17, 2002 4:53 AM
> Subject: RE: another reg needed
>
> > probably what you wanted is:
> >
> > ($row, $col) = /(\d+)/g;
> >
> > > -----Original Message-----
> > > From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, August 16, 2002 4:49 PM
> > > To: Connie Chan; Beginners Perl
> > > Subject: RE: another reg needed
> > >
> > >
> > > Connie,
> > >
> > > This is what I am looking for!  But all I get is','.
> > >
> > > Thanks,
> > >
> > > Jerry
> > >
> > > -----Original Message-----
> > > From: Connie Chan [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, August 16, 2002 3:34 PM
> > > To: [EMAIL PROTECTED]; Beginners Perl
> > > Subject: Re: another reg needed
> > >
> > >
> > > > $_ = "Die,Row 0, Column 12"
> > >
> > > do you trying to get this ?
> > >
> > > my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/;
> > > # $row = 0;
> > > # $col = 12;
> > >
> > > /^ means beginning of line
> > > ..+ means anything
> > > \d+ means 1 more more digit numbers
> > > (xxx) capture matched values within blankets in order to $1, $2...$x.
> > > $/ means the end of the line.
> > >
> > > >
> > > > What I want is the 0 and 12.  What about the text?
> > > >
> > >
> > > So what do you want to deal with the text ?
> > >
> > > Rgds,
> > > Connie
> > >
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > ----------------------------------------------------------------------------
> > --------------------
> > The views and opinions expressed in this email message are the sender's
> > own, and do not necessarily represent the views and opinions of Summit
> > Systems Inc.
> >
> >

your version:

($row, $col) =~ /(\d+)/g;

means:

1. turn ($row, $col) into a scalar which is a nubmer of element of the array which is 2
2. and then turn the numeric number 2 into a string which is "2"
3. and then search the string "2" for /(\d+)/g which will never success

remove the '~' characeter and the reg. expression is searched on the $_ variable and 
it will then
success

david


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

Reply via email to