Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
WHY? This is suddenly very frustating. Maybe some one here can help me get around this problem. I have a set of strings with a prefered sort order. So I wrote a hash associating each string to it's position in the sort order, and then a sub SortByMyOrder method to do the look ups. It gets used in lots o' places, so I moved it into a small package. But now it doesn't work any where because $a and $b are not in the right package. I could solve this with eval and caller, but I don't want to do that because qsort could potentially make lots o' calls into this method. How can I tell Perl to get the $a and $b scopes correct?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: package globals and sort()
by tachyon (Chancellor) on Apr 19, 2002 at 00:39 UTC | |
by Anonymous Monk on Apr 19, 2002 at 00:49 UTC | |
by tachyon (Chancellor) on Apr 19, 2002 at 01:10 UTC | |
by Anonymous Monk on Apr 19, 2002 at 01:48 UTC | |
by tachyon (Chancellor) on Apr 19, 2002 at 02:09 UTC | |
|
Re: package globals and sort()
by japhy (Canon) on Apr 19, 2002 at 02:50 UTC |