Changeset 31577

Show
Ignore:
Timestamp:
06.04.2017 14:48:16 (2 years ago)
Author:
kjdon
Message:

changed my mind. now declaring aStr and bStr variables, cos what if the a and b coming in are not the same as global a and b?? maybe there is room for things to go wrong? so lets explicitly declare the variables

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/classify/List.pm

    r31576 r31577  
    976976sub alpha_numeric_cmp 
    977977{ 
    978     my ($self) = shift (@_);  
    979  
    980     if ($a =~ m/^(\d+(\.\d+)?)/) 
     978    my $self = shift (@_);  
     979    my ($aStr, $bStr) = @_; 
     980    if ($aStr =~ m/^(\d+(\.\d+)?)/) 
    981981    { 
    982982        my $val_a = $1; 
    983         if ($b =~ m/^(\d+(\.\d+)?)/) 
     983        if ($bStr =~ m/^(\d+(\.\d+)?)/) 
    984984        { 
    985985            my $val_b = $1; 
     
    991991    } 
    992992     
    993     return ($a cmp $b); 
     993    return ($aStr cmp $bStr); 
    994994} 
    995995