in reply to Re: Predeclaration
in thread Predeclaration

Thanks broquaint guess I'll stop doing it then. My question now is why does anyone bother to predeclare if it has no effect or an adverse effect.

I suppose it must just be for improved readability and to help the stongly typed converts

Replies are listed 'Best First'.
Re: Predeclaration
by Anonymous Monk on Jul 16, 2002 at 13:13 UTC

    People generally predeclare with my to assist with error-checking. If you add the pragma use strict; to the top of your program, all variables have to be declared with my or our before they're used. This helps eliminate errors due to variable name typos.

    For example:

    use strict; my $typo; $tuypo = "Here's some data: $data"; print $typo;
    will produce an error.