i am new to perl modules (well, any perl more advanced than CGI business).
i have made a module that returns a hash reference (the hash is a hash of
a hash, populated by $outer{$inner} = { a=>b, c=>d }).  when i use a sort
subroutine ({ $a->{'field'} <=> $b->{'field'}) on a hash in its module,
then use that subroutine on another hash in another module, the sort does
not work (use of uninitialized value in numeric comparison <=>).  i am
guessing this has to do with $a and $b in the module the sort routine is
in...

basically, to be more detailed, i am creating and sorting one type of hash
in one module, and creating another type of hash in another module, and
sorting *that* hash using a the fields of a hash from the first module
that was sorted with the first modules's sort routine (phew!).  eg, i
have module A and B, and hash %ha and %hb from A and B respectively.
i am sorting %ha with a sort routine from A, but called from inside B.

foreach $hav (sort A::sortfunc values %ha)
{
        print $hb{$hav->{'a'}}->{'b'};
};

i am using my throughout the modules, but i am returning a reference, but
it still works when i return a reference to a my var from one module to
another.  regardless, i can't get the sort to work.

thanks (i hope people can understand this messy situation...),

-chris grierson

[ Structural Informatics Group  ]
[ Dept. of Biological Structure ]
[ University of Washington      ]

[ 206.616.7356:office ]
[ 206.795.4998:cell   ]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to