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.
  • my @x;
    undef @x;

    my $x = [];
    undef @$x;
    undef $x;

    Personally I think I'd prefer the syntax $a{foo}[] for @{ $a{foo} }; that might even be backwards-compatible. Of course, the heuristic that the parser uses to check the sigils would need completely changing, which would be a nasty job, and you lose the human-heuristic that 'if it starts with @ it's multiple-valued' which was the whole point of the multiple deref operators in the first place.

    • undef @$x;

      Good catch – if you need to dereference a ref without using a [] or {} indexing operation, you need the @{} bracket. I guess that explains the ugly new syntax in Perl 6.

      I guess ${} is always necessary by the same token.

      All in all, not the majority of cases.