in reply to problem with regex
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem with regex
by zerodmg (Novice) on Dec 14, 2016 at 12:57 UTC |