in reply to Re: Why is "any" slow in this case?
in thread Why is "any" slow in this case?

> every time you access $1 or $2, there is a check of the regexp context,

Could you please elaborate what this means, especially "regexp context"?

It rings a bell, but this seems counter-intuitive with a read only value like $1.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: Why is "any" slow in this case?
by ysth (Canon) on Jul 28, 2025 at 16:22 UTC
    If you use $1 and then Devel::Peek::Dump it, you will see the values you got stored in it, but that's all ephemeral; the next access will trigger the get magic again, which does a lot of work to get info from where the regex engine stashes it (and leaves it in the $1 SV so the remainder of that operation can use it).