Hello All -
I'm relatively new to Perl (I've been in mainframes for 15 years, though) and am having a lot of trouble understanding, hash, array and how to sort. I have installed a version of Selena Sols' Webstore (as well as Matt Kruse's CALENDAR (which I've modified to read a MySQL database) and Chris Hardie's DB_Browser) just so you know I have SOME idea of wwhat's going on. I would like to sort my newest items to the top. Currently, Items are retrieved in the order they are entered. I think I've found that the easiest and least intrusive place to do this is at the completion of the "Add Item" code and just sort the entire file after the "add." (The file is small enough that speed and size shouldn't be an issue.) Additionaly, I'd like to sort the first field ascending and the second descending. Can someone help me out here? Is there an easy way to sort this entire file?
Here is the current code that completes the "ADD" process:
Thanks,
Tom
I'm relatively new to Perl (I've been in mainframes for 15 years, though) and am having a lot of trouble understanding, hash, array and how to sort. I have installed a version of Selena Sols' Webstore (as well as Matt Kruse's CALENDAR (which I've modified to read a MySQL database) and Chris Hardie's DB_Browser) just so you know I have SOME idea of wwhat's going on. I would like to sort my newest items to the top. Currently, Items are retrieved in the order they are entered. I think I've found that the easiest and least intrusive place to do this is at the completion of the "Add Item" code and just sort the entire file after the "add." (The file is small enough that speed and size shouldn't be an issue.) Additionaly, I'd like to sort the first field ascending and the second descending. Can someone help me out here? Is there an easy way to sort this entire file?
Here is the current code that completes the "ADD" process:
Code:
##
open (NEW, "+>> $datafile");
print (NEW "$in{'sku'}|$in{'category'}|$in{'price'}|$in{'name'}|$formatted_image|$formatted_description|$formatted_option_file\n");
close(NEW);
##
Thanks,
Tom