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.
  • Maybe this doesn't make sense but some way to stick with method calls appeals to me.

    Instead of:

    @dogs.sort: { .name }

    Something like:

    But even as already implemented, I agree it's an improvement and a nice language feature. Thanks, Patrick!

    • Part of the difference here is that .sort_by (or .sort) is a method call on the list as a whole, and any method call after that really ought to be treated as a method call on the resulting sorted list. For example,

      @list.sort.reverse { ... }

      Also, something like gets the invocant in the wrong place, because in order for this to work the invocants to .name should be the individual elements of @list.

      So, I think the information on how to sort (e.g., .name) really deserves to