Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I saw Damian speak here in Portland, OR, and that was what finally convinced me that the new sigils are the way to go. I'm teaching Perl to a friend of mine right now and he's terribly confused about the difference between these two:

    $foo = {};
    %foo = ();

    Mind you, I was trying to steer him away from references while he was first learning, but he's pretty ambituous and is really digging in. He thinks he's getting the hang of it, but I suspect that his mind is really going to get blown when he sees a hash slice.

    @foo{ qw/ bar baz / };

    So we have three different sigils that we can have at the beginning of a hash, but newer programmers are not expecting that. Oh, wait! What if I assign a hash via a typeglob? I guess we have a fourth sigil. Or I could have a constant return a hash and have no sigil, but that's getting silly, right? Personally, I'm not sure that it is. TIMTOWTDI is great, but this area keeps tripping people up.

    • I've never been keen on a hashref slice:
      @{$hr}{qw/bar baz/};
    • I hate the new sigil system.

      What I like about perl5's way of doing it is that the sigil is not part of the variable name, it's an indicator of the type of the expression. $h{x} is a scalar expression. In perl6, the sigil is simply part of the variable name, which means it really adds nothing -- zilch! -- for either the human or the compiler, other than to say (e.g.) "this is a hash variable". I'm sorry, but the compiler and I can both tell that $h{x} is referring to a hash variable.

      The whole sigil thin