On Wed, Feb 21, 2001 at 11:32:29AM -0500, John Porter wrote: > Lou Hevly wrote: > > __DATA__ > > ae|Evans|Anne > > le|Evans|Louise > > he|Evans|Helen > > je|Evans| > > pete||Peter > > xs|Sanchez| > > rwj|| > > est|| > > > > 1) If there's a last name, the program should sort first by that and then by the firstname (if there is one); > > 2) If no last name, then sort by first name; > > 3) If neither last nor first name, then sort by username > > map { $_[1] } > sort { $a->[0] cmp $b->[0] } > map { [ join( '', reverse split /\|/ ), $_ ] } > <DATA>; That would sort foo|bar|baz and foo|bazbar| as being equivalent. However, xx|fnord|bazalt should sort between them, resulting in: baz, bar, foo bazalt, fnord, xx bazbar, foo Abigail ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe