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.
  • I don’t see why we’re being forced to write the outer deref. It could be much simpler:

    push $hash->{key}, 42;

    Much nicer than autoboxing, too.

    There’s never any more or less of a guarantee that $hash->{key} will be an array-ref anyway, regardless of which way you write it. There's never any ambiguity there either. The current rule is just arbitrary outgrowth of the prototype brain damage. A better way to approach the problem that prototypes attack would have been to provide a prefix notation for binary operators and then declare push et al an operator.

    I had hoped that autoboxing would at least give me something close to that by means of indirect object syntax:

    push $hash->{key} 42; # note the missing comma

    However, no dice. I can find no way to convince Perl to parse something that starts out like a plain push invocation as an indirect object method call instead. It always complains that something is wrong before it gets to the end of the expression.