Hmm... something's a little odd here. Pseudo-hashes are arrayrefs with a hash associating fieldname with array index as the first member. If @$foo contained a bunch of arrayrefs which contained hashrefs, the error would make sense to me, since Perl might see the first member of $a and $b and get confused.
Here, though, you say that @$foo contains hashrefs. Therefore $a and $b should both be hashrefs, and there shouldn't be any confusion on Perl's part. So either A. there's a serious bug in Perl, or B. the data in @$foo is not what you think it should be. If you can isolate the behavior into a small standalone program and post it here, then I'll be more willing to believe it's a bug in Perl. :)