in reply to Re^3: Use global flag when declaring regular expressions with qr?
in thread Use global flag when declaring regular expressions with qr?

(note the parens) ... say for ($str =~ m/$rex/g);
The parens in the for? Those do absolutely nothing.
--
A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |

Replies are listed 'Best First'.
Re^5: Use global flag when declaring regular expressions with qr?
by Tux (Canon) on Oct 29, 2024 at 13:24 UTC

    Old habits die hard: every time I expect a m/(.).(.(.)/ or m/(.)/g to return a list that I want to keep, I add parens

    I don't know what hit me in the past to come to that habit


    Enjoy, Have FUN! H.Merijn