Hi zerodmg,
See the discussion of m/PATTERN/ in Regexp Quote Like Operators: In scalar context, $string=~/.../ returns true/false for whether the match succeeded or not, in list context it returns the capture groups (unless you use the /g modifier, then the return value is different). The latter is what tybalt89 is showing you in the example, putting parens around the variable(s) in a my ($x) = ... assignment causes the right side to be evaluated in list context.
Hope this helps,
-- Hauke D
In reply to Re: problem with regex
by haukex
in thread problem with regex
by zerodmg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |