SHARE
TWEET

Untitled

a guest Feb 27th, 2012 20 Never
  1. sub sort_items {
  2.     my $items = shift;
  3.  
  4.     my @items_sorted = sort {
  5.        ( $a->{'id'} || 9999999999999 ) <=> ( $b->{'id'} || 9999999999999 )
  6.         ||
  7.         ( psql_date_to_DateTime( $a->{'dateend'} ) <=> psql_date_to_DateTime( $b->{'dateend'} ) )
  8.  
  9.     } @$items;
  10.  
  11.     \@items_sorted;
  12. }
  13.  
  14.  
  15. # later ...
  16.  
  17. sub foo {
  18.    my $items = shift;  # array ref
  19.    $items = sort_items( $items );
  20. }
RAW Paste Data
Top