johnfl68 has asked for the wisdom of the Perl Monks concerning the following question:
Hello:
I need to rewrite some code, and probably almost a complete rewrite at that.
I am getting Arrival and Departure data for an airport, currently in XML, but I can also do JSON. This contains other information besides the flightStatus's (see example):
https://www.dropbox.com/s/w50uliyoxug4r5m/depart.xml.txt
Part of the problem is currently the data is being sorted by XML::Simple by the 3 letter Airport code, and I really need things sorted by Arrival/Departure times.
I admit I am not the best when it comes to working with hashes and arrays, but willing to try and learn if pointed in the right direction.
As I am on a shared server, it is often a bit of work getting things added, so I am working with core modules, plus I have XML::Simple and JSON::XS as well. The only reason I bring this up, is often people here offer up all these other modules that are not part of the core. That is fine if you are on your own server and can easily add what you want. It's not quite that easy on a shared server unfortunately.
Everyone seems to be going the JSON route these days, so probably rewrite in JSON unless there is a reason to go with XML I guess.
If I somewhat understand correctly, the best option would be to load the hash data from the XML/JSON into an Array, which will make sorting easier? Is this the best route to go?
Does anyone know of a good place to start with examples of how to best go about loading things into an array, and then sorting, if that is the best way?
Again, thank you for your help and guidance as always.
John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looking for suggestions, sorting data from XML or JSON
by davido (Cardinal) on Jul 06, 2013 at 05:53 UTC | |
|
Re: Looking for suggestions, sorting data from XML or JSON
by martell (Hermit) on Jul 06, 2013 at 12:36 UTC | |
|
Re: Looking for suggestions, sorting data from XML or JSON
by hdb (Monsignor) on Jul 06, 2013 at 08:15 UTC | |
|
Re: Looking for suggestions, sorting data from XML or JSON
by Anonymous Monk on Jul 06, 2013 at 07:21 UTC | |
|
Re: Looking for suggestions, sorting data from XML or JSON
by johnfl68 (Scribe) on Jul 07, 2013 at 04:44 UTC | |
|
Re: Looking for suggestions, sorting data from XML or JSON
by locked_user sundialsvc4 (Abbot) on Jul 06, 2013 at 19:08 UTC |