in reply to Something fishy about my scope

If you look here the perldoc says, "my($x) creates a new variable x that is only visible in the current subroutine." So assuming that the if statement block is in the same subroutine, I believe $database is still local.

bW

Replies are listed 'Best First'.
Re: Re: Something fishy about my scope
by sauoq (Abbot) on Dec 10, 2002 at 21:11 UTC

    Don't believe everything you read. That simply isn't a very good explanation of my() and lexical variables. Lexical variables are visible only in their enclosing file, block, or eval.

    -sauoq
    "My two cents aren't worth a dime.";