All:

Is there a way to suppress a specific warning message produced by Perl?

Example program:

====================================
use strict;
use warnings;

my $a = "abc";

if ($a == 7) {
        print "a = 7\n";
}
else {
        print "a != 7\n";
}
=====================================

Output from Perl debugger when this program is run:

======================================================================
$ perl -d test.pl

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(test.pl:4):      my $a = "abc";
  DB<1> s
main::(test.pl:6):      if ($a == 7) {
  DB<1> s
Argument "abc" isn't numeric in numeric eq (==) at test.pl line 6.
 at test.pl line 6
main::(test.pl:10):             print "a != 7\n";
  DB<1> s
a != 7
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
  DB<1>
=======================================================================

I can suppress all warning checks by doing a:

no warnings;
if ($a == 7) {
use warnings;

but I would like all other "normal" Perl warnings to be used for the
statement:

if ($a  == 7)

other than the check for the LHS of the equality check being a numeric
value.

Is this possible?

Regards,
Gavin Bowlby


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to