in reply to Global vs. Local

Sounds like you need to stick  my before every variable.

when you are using strict (which you always should), variables must be declared this way.

Update : Read this on strict before you go any further in your Perl career. It will definitely help you on your way :).

HTH

Azatoth a.k.a Captain Whiplash

Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?

Replies are listed 'Best First'.
Re: Re: Global vs. Local
by davorg (Chancellor) on Mar 09, 2001 at 14:11 UTC
    Sounds like you need to stick my before every variable.
    when you are using strict (which you always should), variables must be declared this way.

    <pedant>
    Well, that's not strictly true. When using strict you must either pre-declare variables or use their fully qualified names.

    You can pre-declare lexical vaiables using my or package variables using use vars. You can also use our if you're using Perl 5.6 or later.

    You can use package variables without pre-declaring them by giving them a fully-qualified name, e.g. $main::scalar, @main::array or %main::hash. These can also be abbreviated to $::scalar, @::array and%::hash.
    </pedant>

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me