On Mon, 7 Jun 2004, Ranga Nathan wrote:
But why should the compiler care if I used a variable only once?
Because the rest of your program may have $foobar 42 times, but this one line has $foobaz, and the compiler can't be sure that that's a mistake, but chances aren't bad that that odd one out may be a typo.
If you define a variable & use it only once, the compiler will complain. If that's really, really what you meant, I suppose you could suppress the warning by including a second line that does a no-op ("$foobaz;"), but you'll probably get different errors in that case.
Arguably, using a variable only once is less efficient at runtime than just inlining the original assignment, but one-off variable may make the code easier to read & maintain, so any performance hit may be worth it.
Warnings aren't the end of the world as long as you understand why they are happening; in this case that's clear, so it shouldn't be a big deal.
-- Chris Devers _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

