[lug] Perl Question..

Joseph McDonald joem at uu.net
Wed Apr 16 16:25:39 MDT 2003


Ok cool, got that working! 

On Wed, Apr 16, 2003 at 03:57:08PM -0600, Jeff Schroeder wrote:
> Joseph asked:
> 
> > Not directly linux related, so hopefully I don't get flamed
> > but can anyone think of a way to sort this array into a list
> > which matches the actual calandar months? Meaning, Jan, Feb,
> > March, April ... Dec. I've been racking my brain today to no
> > avail:
> 
> I'll give what is probably the obvious answer:
> 
> Use a "reference" hash where the month name is the key and the value is 
> the number; e.g.:
> 
> my %months = ("January" => 1, "February" => 2, ...);
> 
> Then when you're sorting @array you could do a lookup into the hash to 
> determine what order to print or manipulate your data.
> 
> I don't know if that fits into the scheme of your larger script, but...
> 
> HTH,
> Jeff
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug



More information about the LUG mailing list