#figure this out later#my $separator_characters=" _-\\\\\\\."; # these are the separator characters ready for use in a regex sub __natural_split_item($) { my @out_array; # # by brute force we will separate a string into the output array # by these cases as they are found: # # separator characters # numerics # alpha/non numeric # # we may need to add other stuff in the future... # # when we change to a different type we will push the previous data into # the output array. # my $last_type=0; # set to no previous my $last_split=""; if(defined $_[0]) # we may get an undefined item.... { for(my $i=0;$i $b_list[$i] if $a_list[$i] != $b_list[$i]; # simple numeric compare if not same value return $a_list[$i] cmp $b_list[$i] if $a_list[$i] ne $b_list[$i]; # ascii compare so we can handle leading zero variationsif not same value } return (lc $a_list[$i]) cmp (lc $b_list[$i]) if (lc $a_list[$i]) ne (lc $b_list[$i]); # compare as same case first #return ($a_list[$i]) cmp ($b_list[$i]) if ($a_list[$i]) ne ($b_list[$i]); # then compare as case sensitive (maybe) } return (length @a_list) <=> (length @b_list); # just do list length - longer list should be later. if items the same then it does not matter.... }