in reply to Dynamic sort algorithm selection
So basically you want a pointer to a function.
I'm not too sure how to do that..I know that you
can create/use pointers within perl, but I haven't
dug through my tchrist notes in too long to even
have a clue of remembering how.
As far as making pointers to functions...couldn't
you just make a simple if/else or case based on the
designation variable to avoid the whole headache?
TIMTOWTDI, and all that, I guess.
What algorithm are you looking to use for your
array sort? The first glance made it look like a
bubble sort, which is fine if you aren't trying for
high performance. Otherwise, _Algorithms and Data
Structures_ by Corman-- aka the white cookbook, is
a good place to get a lot of non-language specific
psuedocode for just about every basic sorting option.
good luck, -B.
I'm not too sure how to do that..I know that you
can create/use pointers within perl, but I haven't
dug through my tchrist notes in too long to even
have a clue of remembering how.
As far as making pointers to functions...couldn't
you just make a simple if/else or case based on the
designation variable to avoid the whole headache?
TIMTOWTDI, and all that, I guess.
What algorithm are you looking to use for your
array sort? The first glance made it look like a
bubble sort, which is fine if you aren't trying for
high performance. Otherwise, _Algorithms and Data
Structures_ by Corman-- aka the white cookbook, is
a good place to get a lot of non-language specific
psuedocode for just about every basic sorting option.
good luck, -B.
In Section
Seekers of Perl Wisdom