punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:

Mucho Gusto Monks,

My Perl script runs perfectly until I rename a hash "states".

Call it anything else in its declaration, and the script runs fine. Call it "states", and I get the dreaded Internal Server Error.

Is "states" a reserved word?

Thanks




Forget that fear of gravity,
Get a little savagery in your life.

Replies are listed 'Best First'.
Re: Is "states" a reserved hash name??
by chromatic (Archbishop) on Mar 10, 2007 at 22:03 UTC

    There are no reserved hash names (except for upper-cased hashes that Perl uses internally). You probably have a typo somewhere. If you have strict and warnings enabled, your error log should give you a warning message; see perldoc perldiag for help in diagnosing it.

    Otherwise, post the minimal amount of code that demonstrates the problem and someone here can point out the typo.

      OK, that's all I needed to know before speinding the time to find a typo somewhere.....

      Thanks.




      Forget that fear of gravity,
      Get a little savagery in your life.

        Not only that, but you can test your program for compilability at the command line, without actually running it, using perl -c.

        *Yes, technically, it's not quite this simple. But this oversimplification is useful in many cases, especially when just starting out.

        A word spoken in Mind will reach its own level, in the objective world, by its own weight
        Can you post your code? :-)
Re: Is "states" a reserved hash name??
by ikegami (Patriarch) on Mar 11, 2007 at 02:37 UTC

    and I get the dreaded Internal Server Error.

    Check the server's error log for error messages.

Re: Is "states" a reserved hash name??
by stonecolddevin (Parson) on Mar 11, 2007 at 07:33 UTC

    Check out CGI::Carp. use CGI::Carp qw[fatalsToBrowser] will send all fatal errors to the browser in a fairly nice format to look at.

    Hope this helps!

    meh.
Re: Is "states" a reserved hash name??
by DrHyde (Prior) on Mar 12, 2007 at 10:36 UTC
    "Internal Server Error" is not generated by perl. It sounds like the sort of thing a web server might spit out. Look in its logs for details.

    I suspect that you have:

    • a typo in your code; or
    • you are using strict (like you should) and forgot a my; or
    • you are trampling on a %states that is being used by some other piece of code

    And no, %states is not reserved:

    $ perl -Mstrict -Mwarnings -e 'my %states' $