in reply to Sorting Data by Date

As mentioned previously, using sprintf will allow you to format your data correctly. As for the sort, the following would work, if I understood your requirements correctly, but I seriously doubt that it's the most efficient way to do things.

use strict; use Data::Dumper; my @expos; chomp( @expos = <DATA> ); @expos = map { "$_->[0]|$_->[1]/$_->[2]|$_->[3]/".(join "|", @{$_}[4. +.$#$_]) } sort { $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] } map { [ split '[|/]', $_, 8 ] } @expos; print Dumper \@expos; __DATA__ Macworld Expo|2/7|1/12|San Francisco|CA|http://www.macworldexpo.com Another Expo|1/27|2/5|San Francisco|CA|http://www.anotherexpo.com Some Expo|1/6|1/12|San Francisco|CA|http://www.macworldexpo.com

Generally, one should avoid a Schwartzian transform if the you do not have expensive data munging, but it's the first thing that occurred to me and I think they look rather cool :)

Cheers,
Ovid

Vote for paco!

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.