D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] perl question - how to sort arrays of hashes? [SOLVED]

 

On Sun, 3 Feb 2008 00:53:21 +0000, Steve Marvell
<steve@xxxxxxxxxxxxxx> wrote:

>Dave Morgan wrote:
>
>> @sorted = sort { $a->{mtime} <=> $b->{mtime} } @jpeg;
>
>If you are dealing with a lot of items, you should consider a
>Schwatzian Tranform.
>
>Steve

Considering that I will only be running the script a couple of
times a month, and having spent up to 10 hours each time
gathering GPS and jpeg data, an extra couple of minutes here or
there are not important. Absolute worst case is matching 250
jpegs to 45000 lines of GPS data, and as both lists are already
sorted by time, I can do this fairly quickly. The major overhead
is reading/writing EXIF data.

Keeping the code as simple as possible so I can write and
maintain it with my limited Perl skills is a higher priority.

best regards
Dave
-- 
http://www.morgad.co.uk/index.html 
DP: http://www.pgdp.net   NTP: http://www.pool.ntp.org
L&B: http://www.lynton-rail.co.uk

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html