XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: 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 reply to Re^2: Dualvar via table
by LanX
|
|