in reply to Re: Re: Date comparison
in thread Date comparison

Since str2time() is a relatively expensive routine, this a perfect time for pulling out the "Orcish Maneuver".

In the example above, change   my @sorted = sort {str2time($a) <=> str2time($b)} @dates; to

my %cache; my @sorted = sort {($cache{$a} ||= str2time($a)) <=> ($cache{$b} ||= str2time($b)) } @dates;

Replies are listed 'Best First'.
Re: Re: Re: Re: Date comparison
by George_Sherston (Vicar) on Jul 08, 2002 at 09:48 UTC
      But why "orcish"?

      The Orcish Maneuver gets its name from the use of the "or" assignment operator (||=) to "cache" values within a Schwartzian transform. "or" + "cache" --> "orcish".