$pair{$nfile+1} = [($n,$m)];
my @lpair = sort { ssPair($pair{$a},$pair{$b}) } keys %pair;
for(@lpair){
my $ref = $pair{$_};
my @a = @$ref;
print "'m = $a[1] n = $a[0]',\n";
$ref = $allcost{$_};
my @v = @$ref;
for(@v){
print $output "$_\n"
}
}
sub sPair{
my $ref1 = shift;
my $ref2 = shift;
my @aa = @$ref1;
my @bb = @$ref2;
if($aa[0] < $bb[0]){
return -1;
}
elsif($aa[0] == $bb[0] and $aa[1] < $bb[1]){
return -1;
}
elsif($aa[0] == $bb[0] and $aa[1] > $bb[1]){
return 1;
}
elsif($aa[0] == $bb[0] and $aa[1] == $bb[1])
{
return 0;
}
return 1;
}
Suscribirse a:
Enviar comentarios (Atom)
Todavía no sé como publicar código en el blog
ResponderEliminar