in reply to Re: Shorten script
in thread Shorten script

Just one correction and one nag:

The or has too low precedence and should be replaced with ||.

$_ isn't localized. I know, I'm cranky about this, but I actually find it worth pointing it out all the time. :-) (Take a look at Localizing $_ and while (<FH>) { ... }. (Is really: "Re: Re4: matching every occurrence of a regex") for a more elaborate view.)

ihb

Replies are listed 'Best First'.
Re: Re: Re: Shorten script
by BrowserUk (Patriarch) on Jul 23, 2003 at 12:32 UTC

    ++ Well picked up on the or thing. I really should have added an "untested" rider to that code. It was purely an editor exercise and completely untested. I should have spotted the error, but I tend to use or rather than || as a matter of course and let the compiler inform me when I need to change it. Hey, that's what compilers are good at :)

    With respect to the non-localisation of $_ in while loops. Your right to point it out. It's one of those things that I take on a case by case basis, but it is so useful, that I wouldn't want to never use it.

    Does anyone know if there is a good reason why $_ isn't localised in while loops as it is in for loops?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller