in reply to Re: BEGIN, strict, and variable assignment
in thread BEGIN, strict, and variable assignment

I don't see how any of these suggestions help in this situation. You still need to put the initialization into a BEGIN block (for the first two suggestions) which means the declaration needs to be separated from the initialization (except in the second case, where they are already separated) or else the variable won't be of any use outside of the BEGIN block.

So to use any of the suggestions you made, you'd still need the declaration separated from the initialization.

- tye        

  • Comment on Re^2: BEGIN, strict, and variable assignment (?)

Replies are listed 'Best First'.
Re: Re^2: BEGIN, strict, and variable assignment (fecklessness)
by broquaint (Abbot) on Mar 03, 2004 at 18:01 UTC
    You're completely right, I really don't know what I was thinking. The above examples would need to be re-written as
    BEGIN { our %tests = ( ... ) } BEGIN { use vars '%tests'; %tests = ( ... ) }
    Which does indeed make them rather redundant suggestions. The suggestion from blokhead in Re: BEGIN, strict, and variable assignment looks to be the most sensible route to take.
    HTH

    _________
    broquaint