in reply to Re^4: Why is "any" slow in this case?
in thread Why is "any" slow in this case?
Why do we need $1 to be magic, when it's read-only?
We don't need it to be. As I mentioned, the alternative would be to make make a copy of the matched text on match. The down side is that this would happen even if $1 isn't used. Same goes for all the other vars I mentioned.
if this is about avoiding overhead for optional variables, retrieving it just once on demand would be sufficient.
That's not how magic works. Get magic changes a variable from something that stores a value, to a function that produces the value on demand. You can either store the value in the var, or generate it each time the var is accessed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Why is "any" slow in this case?
by LanX (Saint) on Jul 28, 2025 at 20:33 UTC | |
by ikegami (Patriarch) on Jul 29, 2025 at 11:35 UTC |