Jeff 'japhy' Pinyan wrote:
The difference is the context. A pattern match returns different values depending on whether it was called in scalar context or list context. In scalar context, a pattern match returns whether or not it was able to match. In list context, the pattern match returns the capture groups:

  $x   = "japhy" =~ /(.)...(.)/;  # $x = 1
  ($x) = "japhy" =~ /(.)...(.)/;  # $x = 'j'
  @x   = "japhy" =~ /(.)...(.)/;  # @x = ('j', 'y')

By placing parentheses on the left-hand side of an = operation, you're creating a list of values (even if it's one, or even zero values).

If the pattern match has the /g modifier on it (for global matching), the context changes how it behaves as well.


Thanks so much.
I cant believe I did know, realise that.

Thanks again
Brent Clark


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