in reply to Mistaken notions of $a/$b strict
in thread use strict won't require explicit name for all variables?

Ah, but the "action at a distance" most certainly does occur. If you create a sorting sub in one module and use it in another ... Look at the following code:
my $a = 5; my @b = reverse (0 .. 9); print "@b\n"; sub boo { $a <=> $b } @b = sort boo @b; print "@b\n"; print $a,$/; ---- 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 9 8 5 6 7 5
Note the lack of sorting after 4. :-)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re2: Mistaken notions of $a/$b strict
by blakem (Monsignor) on Mar 01, 2002 at 02:13 UTC
    While I don't have time to fully explain it, you can actually use prototypes(bleck) to avoid the weirdness in $a and $b (ughhh) for 5.6 and above....
    sub boo ($$) { my ($a,$b) = @_; $a <=> $b }

    -Blake

      Actually, just scoping $a and $b to boo() is enough. I didn't realize they were passed in through @_. :-)

      ------
      We are the carpenters and bricklayers of the Information Age.

      Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.