I need to sort the contents of an array of hashes by 'distance'.. I have attached the code below.
-----------------------------------------------------------
# Get the list of stores by zip
my $select = "SELECT * FROM stores ORDER BY store_id DESC";
my $db_data = $lib->sql_arrayref($select);
my @temp_array = (); # Loop data
for my $col (@$db_data) {
# // DO SOME PROCESSING AND VALIDATION, ETC, ETC..
push @temp_array, {
name => $col->{name},
street => $col->{street},
city => $col->{city},
state => $col->{state},
zip => $col->{zip},
miles => $col->{distance},
}
}
# Need to sort the contents @temp_array for output, by distance $col->{distance}?
M. Brooks
X Concepts LLC
-----------------------------------------------------------
# Get the list of stores by zip
my $select = "SELECT * FROM stores ORDER BY store_id DESC";
my $db_data = $lib->sql_arrayref($select);
my @temp_array = (); # Loop data
for my $col (@$db_data) {
# // DO SOME PROCESSING AND VALIDATION, ETC, ETC..
push @temp_array, {
name => $col->{name},
street => $col->{street},
city => $col->{city},
state => $col->{state},
zip => $col->{zip},
miles => $col->{distance},
}
}
# Need to sort the contents @temp_array for output, by distance $col->{distance}?
M. Brooks
X Concepts LLC