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.
  • subset Guess where { $_ >= 1 && $_ if 42 ~~ Guess { say "yes" } else { say "no" }
    yes
    if 142 ~~ Guess { say "yes" } else { say "no" }
    no
    if 97 ~~ Guess { say "yes" } else { say "no" }
    yes
    subset LowGuess of Guess where { $_ if 42 ~~ LowGuess { say "yes" } else { say "no" }
    yes
    if 97 ~~ LowGuess { say "yes" } else { say "no" }
    no
    if 0 ~~ LowGuess { say "yes" } else { say "no" }
    no

    Are there some curlies/newlines missing here? I'm having difficulty parsing it. (particularly as I've never come across the subset
    • AFAIK the parentheses around the condition are optional in Perl6. So the lines starting with "if" should be ok.
      On the other hand me also thinks that the lines starting with "subset" got mixed up...
    • I'd not written some angle brackets as HTML entities, which resulted in mangled output. Sorry, and fixed now - thanks for pointing it out!
  • I'm generally excited about Perl 6 and what it will be able to do, but I do have one concern. I understand and appreciate TIMTOWTDI because it means I can attack the same problem from different directions which is good. But why so many different ways to pass named parameters to subroutines? Maybe I'm missing something and should go back and read the synopsis (I admit it has been some time) but why so many different syntaxes for the same thing? You're not solving the problem in a different way, you're just u
    • There's only really two syntxes: the fat arrow and the colon pair. I think that everyone is familiar with fat arrow so it's good to keep that, but it's not so easily extensible as colon pair to do some of the common special cases. Like, if you have a variable with the same name as the named parameter you want to pass it as, or if you just want to pass a true or false value. For example, when opening a file you can write :r to mean "read access" and it's as if you'd done r => 1, but neater. It would appea