sub build_sort_links {
# --------------------------------------------------------
# Merges two array refs into one link list.
#
my ($arr_a, $arr_b) = @_;
my @names = split /,/, $LINKS{build_sort_order_category};
my @fields = map { $LINKDB->position($_) - 1 } @names;
my @c = sort { lc join ("", @{$a}[@fields]) cmp lc join ("", @{$b}[@fields]) } @{$arr_b}, @{$arr_a};
return \@c;
}
The problem i see: If you convert this to compare numbers; you will get for all strings the value of 0.
So there must be an "if then" like:
if the string is only 1,2,3,4,5,6,7,8,9,0,. #then its a number
else do normal.
The rexep for this should be something like: ^\d*\.?\d*$
Robert
# --------------------------------------------------------
# Merges two array refs into one link list.
#
my ($arr_a, $arr_b) = @_;
my @names = split /,/, $LINKS{build_sort_order_category};
my @fields = map { $LINKDB->position($_) - 1 } @names;
my @c = sort { lc join ("", @{$a}[@fields]) cmp lc join ("", @{$b}[@fields]) } @{$arr_b}, @{$arr_a};
return \@c;
}
The problem i see: If you convert this to compare numbers; you will get for all strings the value of 0.
So there must be an "if then" like:
if the string is only 1,2,3,4,5,6,7,8,9,0,. #then its a number
else do normal.
The rexep for this should be something like: ^\d*\.?\d*$
Robert