http://www.perlmonks.org?node_id=1071563


in reply to Re: providing a callback routine to sort
in thread providing a callback routine to sort

I really think you did not provide enough information to help you

See Re: providing a callback routine to sort ( $::a $::b )

The only reason $a and $b are undefined is because they're not $main::a and $main::b -- sort deals with $main::a and $main::b or $::a for sort -- this is the OPs problem and the solution, use the right variable (package affects unqualified variables)

sort talks about this exactly

An alternate solution (using prototypes) is also talked about in sort and in chromatics free book Modern Perl a loose description of how experienced and effective Perl 5 programmers work....You can learn this too.

looks probably wrong to me. Left side looks like a function, right side not.

Well, they're both perfectly identical method calls

  • Comment on Re^2: providing a callback routine to sort

Replies are listed 'Best First'.
Re^3: providing a callback routine to sort
by Anonymous Monk on Jan 22, 2014 at 14:24 UTC
    Thank you! I provided $pkgdir::pkg::a and $pkgdir::pkg::b and it worked! My apologies for missing that in the documentation. Unfortunately, it's all the way at end (in very tiny letters ;)