Guest User

Untitled

a guest
Feb 27th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment