http://qs321.pair.com?node_id=537690


in reply to Re^5: top ten things every Perl hacker should know
in thread top ten things every Perl hacker should know

We sort of have a sort_by method in Sort::Maker. But I've never liked the api. There is no denying that an ST is a scary sight to a new programmer not familiar with the idiom. I'd argue it should be wrapped in a sub for clarity most often.

I like the PBP argument for using List::Util and List::MoreUtils functions such as any rather than idiomatic uses of grep. It makes your intention clear, and prevents you from thinking in syntax - no matter how comfortable and familiar that syntax is.

update: added some words for clarity

Replies are listed 'Best First'.
Re^7: top ten things every Perl hacker should know
by salva (Canon) on Mar 20, 2006 at 15:55 UTC
    We sort of have a sort_by method in Sort::Maker. But I've never liked the api

    you should try Sort::Key, it has a very simple API and it's faster and uses less memory than any other perl sorting technique:

    use Sort::Key qw(keysort); my @sorted = keysort { genkey($_) } @data;