This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 27th, 2012  |  syntax: None  |  size: 0.38 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data