The stupid question is the question not asked | |
PerlMonks |
Re^2: Dualvar via tableby LanX (Saint) |
on Jan 17, 2020 at 21:21 UTC ( [id://11111549]=note: print w/replies, xml ) | Need Help?? |
> I've thought a little about using the dual nature of variables in some perl code, but haven't actually taken the plunge I'm not sure if it's a good idea. Perl is adjusting the slots to each other depending on use history. Hence you'd magically loose information, and I'm not aware of a way to inhibit this. That's awfully hard to debug if it happens. (will add an example later)
updatePlaying around, look at what happens at line 7
after incrementing $v, i.e. changing it in numeric context, the string-slot is adjusted to the number-slot° So can this only happen when I change one of the slots? If yes, shouldn't such dualvars always been made readonly, too? Hope you understand my worries.
Cheers Rolf
update°) or some flags are changed. Who knows.... FWIW: a very good article from Brian here: https://www.effectiveperlprogramming.com/2011/12/create-your-own-dualvars/
In Section
Seekers of Perl Wisdom
|
|