in reply to Mini-rant about 'strict'

Where does strict come into play?

You can do:

my %hash; BEGIN { %hash = (bar => 'value'); } ...

Replies are listed 'Best First'.
Re^2: Mini-rant about 'strict'
by Ovid (Cardinal) on Aug 04, 2004 at 21:24 UTC

    Yes, I know about the BEGIN trick. I could also have just moved the assignment above the sub call. That's not difficult. The annoying bit is that in a large program, it's not always clear that an assignment has not occurred even though the programmer (me, in this case) might be staring at assignment. It can look like a weird scoping issue, hence my desire for strict to catch variables that have never been assigned to as opposed to variables that are merely undefined.

    Cheers,
    Ovid

    New address of my CGI Course.

      If you are going to mix declarations and code outside of subs, you might consider always using the BEGIN trick.