in reply to Re: just how special are $a and $b these days?
in thread just how special are $a and $b these days?
What I'm trying to do is write a binary search module that takes the same comparator function that was used to sort the array being search.
I'm getting the idea here that since $a and $b are package variables, sort comparators need to be declared in the same package as their use. I had thought that, for instance
# the following is dumb and is written strictly as an example package backwards; sub pmc { $b cmp $a }; package main; print sort backwards::pmc ( split /\s+/, `cat $0` )
would work as intended.
it doesn't
so it looks like ${caller().'::a'} is going to be where the search key goes, and ${caller().'::b'} is going to be where the guesses go for evaluation. Done with glob aliasing, of course.
Thank you everyone
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: just how special are $a and $b these days?
by BrowserUk (Patriarch) on Mar 04, 2010 at 19:53 UTC | |
by sauoq (Abbot) on Mar 04, 2010 at 22:31 UTC | |
by BrowserUk (Patriarch) on Mar 04, 2010 at 23:36 UTC |