--- EriK W <[EMAIL PROTECTED]> wrote:
> Thanks , Paul, but I think I can't make it straight part of because
> my broken English , so  it seems make sense for me, but

Better to try than sit quietly and be confused. =o)

> > In
> >
> >  ($b =~ /=(\d+)/)[0] <=> ($a =~ /=(\d+)/)[0]
> >
> > the <=> is comparing the first mathed number in the second value to
> > the first matched number in the first value. That's because
> >
> >  $b =~ /=(\d+)/
> >
> > Looks at $b (the default second argument) and matches one or more
> > digits following an equal sign -- the = is a literal character to
> > match here, it's not doing anything magical. Putting parens around
> > it and subscripting
> 
> Until here, I still can't understand why have to need "='' here,
> see if the value of $b is "1234"
> $b=~/(\d+)/ will return "1234"
> $b=~/=(\d+)/ will return "0"

Actually it depends on context -- in list context, it will return an
empty list, won't it??

> then next the ($b =~ /=(\d+)/)[0] will become (0)[0] ?
> what hell this is ?
> then I don't know what the code is going to do next.

  ($b =~ /=(\d+)/)[0]

puts $b =~ /=(\d+)/ into list context, pretends it's an array, and
returns element 0.

Because it's in a list context, $b =~ /=(\d+)/ will search $b for
occurrances of =(\d+), remembering only the digit part, and return the
successful matches as a list. [0] gets the first one.

If $b is "1234" there will BE no matches. The pattern assumes an = in
front of the numbers; I guess it's parsing HTML form data. =o)



=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than 
you are. -- me. =o) 
=============================================================
"There are trivial truths and there are great Truths.
 The opposite of a trival truth is obviously false.
 The opposite of a great Truth is also true."  -- Neils Bohr

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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

Reply via email to