in reply to Can't grab $ARGV[n]

read perldoc perlop or some other documentation. String equality operator is 'eq', numerical equality is '=='. That's as far as I've examined your code, but that'll get you started...

Update: another tip...use strict (use Super Search to search for "strict" in the subject of posts in Tutorials here also). Some of your variables are being set in one scope and used in another...and so have no value (my is a lexical scoping function, e.g. you have 4 different my $figure = ... lines, they each refer to different $figure variables which do not exist outside of the block they are declared in).

Replies are listed 'Best First'.
Re: Re: Can't grab $ARGV[n]
by OxYgEn (Acolyte) on Mar 05, 2004 at 02:48 UTC
    If there were an error in scalar references, wouldn't the command window return some errors?

    And about using strict, I've tried it in a handful of other scripts and when I run them I always get these Global symbol $whatever requires explicit package name errors when I use it. Two thirds of the time, when I take the use strict; line out, it works. This is why I never use strict, though I'm sure it would help me if i better understood it.

      In when you are using strict you have to declare your varibles with the mykey word. ie my $foo = "a bar"; then when you use it later on you can just say $foo = "two bars";.
      The warning you are getting appears when the variables have not been declared in this way. This is helpful beacuse if you mis-spell a variable then you will be warned of the fact. This has saved me about 250,000 times from stupid typos and the like. There are other reasons too I am sure, but this is why I use it.

      Hope this helps.
      If there were an error in scalar references, wouldn't the command window return some errors?
      No, perl let's you use strings as numbers. If it can't figure out a numerical context for your variable, then the value assumed is zero.
      This is why I never use strict, though I'm sure it would help me if i better understood it.
      By all means, take the time to understand it. Start with what is further down in this thread, the Super Search I suggested earlier, and the documentation.

      Update: Another helpful link