> From: Jeff Pinyan [mailto:jeffp@crusoe.net] > Sent: Wednesday, April 12, 2000 09:48 > To: John Porter > Cc: fwp@technofile.org > Subject: Re: [FWP] sifting > > > On Apr 12, John Porter said: > > >print > > map { substr($_,1) } > > sort > > map { > > my $k = 4; > > /gnome/ and $k = 2; > > /session/ and $k--; > > $k.$_ > > } > > <DATA>; > > That sorts the data within itself -- a possibly unwanted side effect. But > I like the GR transform. It would need to be scalable though. I like the GR transform, also. :-) I don't know what you mean by scalability in this case. Here's one way to make it stable: my $i = 0; print map { substr($_, 5) } sort map { my $k = 4; /gnome/ and $k = 2; /session/ and $k--; pack 'C N A*' => $k, ++$i, $_ } <DATA>; -- Larry Rosler Hewlett-Packard Laboratories http://www.hpl.hp.com/personal/Larry_Rosler/ lr@hpl.hp.com ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe