Perl Monk, Perl Meditation | |
PerlMonks |
sorting function arcument to 'sort': Can I pass additional parameters?by mpettis (Beadle) |
on Nov 10, 2008 at 04:16 UTC ( [id://722547]=perlquestion: print w/replies, xml ) | Need Help?? |
mpettis has asked for the wisdom of the Perl Monks concerning the following question:
Update: -- Thank you all very much... I am going to hack in Anonymous Monk's solution, and investigate the other two to see if they will work, as, per blazar, I really DON'T want to pass parameters to sort. Thanks, ========================================= Hi, I want to build a sorting sub within a 'for' loop that is different based on a value within the scope of the 'for' loop. Can this be done? The variables I use in the sub do not seem to be visible within the customized sorting sub. I know that $a and $b are passed automatically to this function -- is there a way to pass in other arguments to the sorting sub other than $a and $b? Thanks, Matt
Back to
Seekers of Perl Wisdom
|
|