in reply to Re: Strict isn't strict enough
in thread Strict isn't strict enough

Agreed, but in more complicated code it may be the result of a single typo being cut & pasted. I have the scars.

Regards,

John Davies

Replies are listed 'Best First'.
Re^3: Strict isn't strict enough
by JavaFan (Canon) on Dec 31, 2011 at 17:20 UTC
    *ANYTHING* can be typoed, and then cut-and-pasted. If your coding style is to randomly hit the keyboard, and then ask perl whether you did a good job, don't expect use strict; to be a silver bullet.

    Perhaps you should replace /usr/bin/perl with

    #!/usr/bin/sh echo "Possible typo detected at line 1. Please fix." exit 1
    BTW, what should perl do if you did my $hwatever and then cut-and-pasted the $hwatever?
      what should perl do if you did my $hwatever and then cut-and-pasted the $hwatever?

      Give a compile time error when I use $whatever. Obviously it isn't a problem if the same typo is used throughout, but if a variable can be used in two places then there is scope for typos that I expected strict to catch before I read the docs. I still want to catch it if I can.

      Regards,

      John Davies

        So, what should happen at:
        package Foo; declare $slave::whatever; # Inventing a keyword to declare fully qual +ified names. $slave::whatever = 1; __END__ package Bar; declare $slave::hwatever; print $slave::hwatever; __END__
        Typo, or intentional?