in reply to Re^6: Determining what line a filehandle is on
in thread Determining what line a filehandle is on

Given that $a and $b are special to sort it is a bad idea to use them as regular variables.

Also note that if you are willing to properly localize them with my, then you should not need to issue an explicit close. Of course declaring $a or $b to be lexical makes writing a sort subroutine hard (hence the first piece of advice).

Finally I think your "only way to fly" comment is a bit strong...

  • Comment on Re (tilly) 7: Determining what line a filehandle is on

Replies are listed 'Best First'.
Re^8: Determining what line a filehandle is on
by tadman (Prior) on Jul 07, 2001 at 18:02 UTC
    $foo and $bar would have done just as well, but after overexposure to Perl Golf, I'm tending to use shorter names anyway. $x and $y perhaps? Recently I was having trouble when I called a variable in a C++ structure "errno". Collisions occur in many languages.

    The "only way to fly" comment is about clarity of programming, not about the way to code. TMTOWTDI is always assumed, of course. IO::Handle's methods do seem to be the clearest from the point of maintenance and understanding, but I'm not advocating that you must use IO::Handle. I am advocating that people create code that works and makes sense.