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

I have an large body of perl code that is filled with upper case comparison operators, ie., EQ, NE. This stuff goes back for ten years or so. When there is no -w there are no complaints with older versions of Perl. With 5.8 there are complaints even without the -w. Is there a way to configure 5.8 that will tolerate this code without complaints?
  • Comment on How To Turn Off Warnings against UPPER CASE comparison Operators

Replies are listed 'Best First'.
Re: How To Turn Off Warnings against UPPER CASE comparison Operators
by Fletch (Bishop) on May 05, 2004 at 20:40 UTC

    Uppercase comparison ops were deprecated in 5.6 (and hence could be ignored with no warnings "deprecated";). They've been made an error in 5.8, so no there's not a way to disable it since it's a syntax error and invalid code.

Re: How To Turn Off Warnings against UPPER CASE comparison Operators
by jmcnamara (Monsignor) on May 05, 2004 at 21:01 UTC

    In the perldelta for perl5.8.0 there is the following statement:

    The long deprecated uppercase aliases for the string comparison operators (EQ, NE, LT, LE, GE, GT) have now been removed.

    --
    John.

Re: How To Turn Off Warnings against UPPER CASE comparison Operators
by artist (Parson) on May 05, 2004 at 21:03 UTC
    Isn't it possible to modify the code automatically (with another perl program)? You may have to create some regex, but with proper testing, your code would be ready for next generation.

    Update (May 6):: Actually if you give all the scenes with represents those operators, we may help you to build the regex.

Re: How To Turn Off Warnings against UPPER CASE comparison Operators
by revdiablo (Prior) on May 05, 2004 at 22:42 UTC

    To build on the other good answers already posted, you have two options:

    1. Fix your code
    2. Don't use 5.8

    You have a hard choice to make. Personally, I would go with the first option, but neither one sounds particularly appealing. Perhaps the long period of time in which the uppercase comparison ops were deprecated should have caused you to think about fixing the code appropriately. 8^)

Re: How To Turn Off Warnings against UPPER CASE comparison Operators
by sgifford (Prior) on May 05, 2004 at 20:40 UTC
    What warning are you getting, and can you give a small code snippet? I can't even get this code to compile under v5.8.3:
    #!/usr/bin/perl if ('A' EQ 'A') { print "Equal\n"; }
    says:
    Bareword found where operator expected at /tmp/test line 3, near "'A' +EQ" (Missing operator before EQ?) String found where operator expected at /tmp/test line 3, near "EQ 'A' +" (Do you need to predeclare EQ?) syntax error at /tmp/test line 3, near "'A' EQ " Execution of /tmp/test aborted due to compilation errors.

    However, if there is a way to suppress this warning, the manpage for perllexwarn would be the place to look.


      There is no warning in perl5.8, it generates an error instead as you found. With perl5.005 and perl5.6 and with -w the following warning is produced:
      Use of EQ is deprecated at EQ.pl line 3. Equal

      --
      John.