You can store your records in a hash (just as
Beatnik pointed out :)
using each record's second field
for the key.
use strict;
use Data::Dumper;
my @a = qw(foo:baz:faz foo:bar:fuss);
my %h= map{ (split(/\:/,$_))[1] => $_ } @a;
print Dumper(\%h);
# to force a '\n' printed after each array element.
$,="\n";
print @h{keys %h};
Getting them inside a hash will assure
that your records are sorted by the second
field in alphabetical order. Here's the output:
$VAR1 = {
'bar' => 'foo:bar:fuss',
'baz' => 'foo:baz:faz'
};
foo:bar:fuss
foo:baz:faz
_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+)
+-.*)$/;
$_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print"
+- $1"}&&`rm $1`;
print$\;}