in reply to Pseudo-hash intrusion...

Exporting is your problem. '$a' and '$b' are package variables to your package, but you (presumably) are sorting in package main. While sorting, '$main::a' and '$main::b' are set, but '$package::a' and '$package::b' are not, which is what the subroutine is using. I'm not sure what the solution is yet, but that's your problem.

Update: Well, I had things slightly backwards not having seen your example above, but glad I helped. Its still rather an ugly solution though having to put the package name in the sortsub thats in the main package... Wish there were something better :-(

Replies are listed 'Best First'.
Solution to Pseudo-hash intrusion...
by dragonchild (Archbishop) on Jun 21, 2001 at 19:40 UTC
    Thanx to runrig, who pointed out that $a and $b are package-scoped, not global-scoped, I modified the sort function to:

    my $sortfunc = sub { $efgh::a->{blah} cmp $efgh::b->{blah} };

    That not only fixed the simple example (where it wasn't sorting), but it also fixed the original app. I have no idea why it was complaining about pseudo-hashes, but I have a working script+module now. :)