|
Posted by John W. Krahn on August 29, 2006, 3:48 pm
Please log in for more thread options
monkeys paw wrote:
> The following is intended to sort an array of hash refs based on
> id_type. It is not working however. Does anyone know why?
>
> use Data::Dumper;
>
> our %datatype_sort = (
> bill => 0,
> reg => 10,
> );
>
>
> my @ary = (
> {id_type => 'reg', id => 'KY200616813'},
> {id_type => 'bill', id => 'CA2005000A5'},
> {id_type => 'bill', id => 'CA2005000A250'},
> );
>
> my @x = sort _sortval_datatype @ary;
>
> print Dumper(\@x);
>
> sub _sortval_datatype {
> my($av, $bv) = @_;
> return $datatype_sort} <=>
> $datatype_sort};
> }
sub _sortval_datatype {
return $datatype_sort} <=> $datatype_sort};
}
John
--
use Perl;
program
fulfillment
|