in reply to Sorting Dates Issue
Please 'use warnings;', that would have brought you the following warnings:
Name "main::d" used only once: possible typo at ./t7.pl line 16. Can't locate object method "user" via package "strict" (perhaps you fo +rgot to load "strict"?) at ./t7.pl line 3.
And $d in the first warning is the problem, it is never set, instead you are setting $c twice
The other warning is because you wrote 'user' instead of 'use'
PS: Your sort line might be better written as my @ordered = sort compare @dates;. As you have it, sort calls the "block-subroutine" which in turn calls the compare subroutine. It is possible that perl optimizes this away but I wouldn't bet on it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting Dates Issue
by Anonymous Monk on Aug 18, 2010 at 17:11 UTC | |
by jethro (Monsignor) on Aug 18, 2010 at 17:21 UTC |