in reply to Re: Problem Declaring Variable
in thread Problem Declaring Variable

definetly pass $yesterday to avoid demerphq's unintended global

-derby

Replies are listed 'Best First'.
Re: Re: Re: Problem Declaring Variable
by Juerd (Abbot) on Mar 13, 2002 at 16:46 UTC

    definetly pass $yesterday to avoid demerphq's unintended global

    Well, if you have subs at the bottom and main code outside of a block, like this author has, ALL lexicals that aren't in a block, are semi-global. So you can avoid having this one as an "inintended global" by putting it in the if-block, but that still leaves all unblocked lexicals. In this stripped piece of code, that's only $today, but in larger programs the results can be disastrous.

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk