Skip to content

Instantly share code, notes, and snippets.

@EvanCarroll
Created October 5, 2009 18:58
Show Gist options
  • Save EvanCarroll/202346 to your computer and use it in GitHub Desktop.
Save EvanCarroll/202346 to your computer and use it in GitHub Desktop.
sub _sort {
no strict;
my %h;
for my $a_or_b ( qw/ a b / ) {
say "$a_or_b: \t $$a_or_b";
given ( $$a_or_b ) {
when ( 'vin' ) { $h{$a_or_b} = -50 }
when ( 'stock' ) { $h{$a_or_b} = -49 }
when ( 'is_new' ) { $h{$a_or_b} = -48 }
when ( 'year' ) { $h{$a_or_b} = -47 }
when ( 'make' ) { $h{$a_or_b} = -46 }
when ( 'model' ) { $h{$a_or_b} = -45 }
default { $h{$a_or_b}=1 }
}
}
return $h{'a'} <=> $h{'b'};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment