in reply to funky $_ with map {}

From Programming PERL 5 2e, 3.2.153 Sort:
Do not declare $a and $b as lexical variables (with my). They are package globals (though they're exempt from the usual restrictions on globals when you're using use strict).
Unless you understand all the possible scoping implications of using $a and $b this way, I'd suggest you avoid using them at all except in matters of sort.

As it turns out, it doesn't cause a problem in this isolated snippet of code, but I recommend you use the solution offered by jeffa.

--Jim

Replies are listed 'Best First'.
Re: Re: funky $_ with map {}
by rjray (Chaplain) on Mar 02, 2002 at 20:25 UTC

    The usage of $a and $b in this context wouldn't hurt him, since there isn't a sort being evaluated. However, it's just as easy to use less-confusing names, or use one of the other methods offered.

    --rjray