logo       

Re: Question on approach: msg#00373

perl-beginners

Subject: Re: Question on approach

On Fri, Jul 24, 2009 at 4:54 AM, Shawn H. Corey<shawnhcorey@xxxxxxxxx> wrote:

[snip]

> Unfortunately, the data is not directly sortable since the date is in
> American format, not SystÃme International (SI). ÂSI dates are directly
> sortable and are the preferred format for storing dates.
>
> I would use a heap to sort:
>

Parts of the date, however, are sortable. Use that to your advantage.

for my $item (sort { $a->[3] <=> $b->[3] || $a->[1] <=> $b->[1] ||
$a->[2] <=> $b->[2] || $a->[4] cmp $b->[4] } map { split /@|-/ }
<DATA>) {
#do something
}

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org

values of Î will give rise to dom!

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
http://learn.perl.org/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise