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 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

    • 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 thing should be dumped completely. Larry is such a huge proponent of "Huffman coding", yet he doesn't go for this obvious, big win. I would much rather indicate the type of my variables at declaration time. I think we've all been convinced of the usefulness of declarations; perl5 strongly encourages them, and perl6 will go that much further. So given that we'll be (very often) declaring our variables to be this class, have those properties, and that initial/default value, it seems like a no-brainer to add type to the declaration statement as well. </rant>

      Or I could have a constant return a hash and have no sigil...

      Um, I don't think so. It could return a hashref, or a list, but not an actual hash variable.