Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • For the benefit of others reading your journal that don't fully understand why this is probably not an easy thing to do....

    sub double { 2 * $_[0] }

    Seems straight forward enough and shouldn't have any side effects. Hrm, what if $_[0] is an alias to a tied variable. What if the FETCH method of that variable has action at a distance. Can't tell just by looking at the source :-(

    • I can tell you without looking at the source that there's a side-effect. $_[0] is going to be used in numerical context, so $_[0] will get its IOK flag (and its IVX value) set. (Effectively, this may turn out to be a no-op, but the potential is there).

      It's really, really hard to do anything meaningful in Perl that doesn't have side-effects.

      • How would these flags being set be visible to the Perl program? Does this mean simply using a variable a particular way in one expression can change how it's treated in other expressions?
        • Yes. The first thing that comes to mind is that it may affect the behaviour of the bitwise ops. There are more examples of subtle effects; I can’t think of them right now, but I know I used to know about them.