[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] sifting



Jeff Pinyan wrote:
> On DALnet #perl this morning, someone was asking how to use sort() to sort
> only so far as to get elements containing "gnome/" and "session" to the
> front, and such that "gnome/" elements preceed "session" elements.

print
  map { substr($_,1) }
  sort
  map {
    my $k = 4;
    /gnome/   and $k = 2;
    /session/ and $k--;
    $k.$_
  }
  <DATA>;


-- 
John Porter

I want to live in a place which the media will later call a "compound".


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe