C:\WINNT>perldoc -q warnings Found in C:\Perl\lib\pod\perlfaq7.pod How do I temporarily block warnings?
If you are running Perl 5.6.0 or better, the "use warnings" pragma allows fine control of what warning are produced. See the perllexwarn manpage for more details. { no warnings; # temporarily turn off warnings $a = $b + $c; # I know these might be undef } If you have an older version of Perl, the "$^W" variable (documented in the perlvar manpage) controls runtime warnings for a block: { local $^W = 0; # temporarily turn off warnings $a = $b + $c; # I know these might be undef } Note that like all the punctuation variables, you cannot currently use my() on "$^W", only local(). HTH, José. > -----Original Message----- > From: chad kellerman [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 01, 2003 6:38 PM > To: [EMAIL PROTECTED] > Subject: Use of uninitialized value in pattern match (m//) at > test.pl line 85. > > > Hi guys, > > How can I get around this "warning" > > Use of uninitialized value in pattern match (m//) at test.pl line 85. > > For some reason I always get driveNum=2. > > I am using warinig and strict in my code.. > > <code> > > if ($pong->ping($mslRef{$server}{ip})) { > > #check for 2 drives > my $cmd = "grep /home2 /etc/fstab|awk \'{print \$2}\'"; > > my ($out, $err, $exit); > eval { > my $ssh = > Net::SSH::Perl->new($mslRef{$server}{ip},identity_files=>["/ro > ot/.ssh/identity"]); > $ssh->login("$user"); > ($out, $err, $exit) = $ssh->cmd($cmd); > }; > if ($@) { > LogIt("Error from eval in Net::SSH::Perl\-> > $@:$mslRef{$server}{hostname}:$mslRef{$server}{ip}"); > }elsif ($err) { > LogIt("Error in command sent thru Net::SSH::Perl\-> > $err:$mslRef{$server}{hostname}:$mslRef{$server}{ip}"); > } > >>>>Line 86 below<<<< > if (defined $out =~ /\/home2/ ) { > my $driveNum = "2"; > #MysqlIt($server,$driveNum,%mslRef); > TestIt($server,$driveNum,%mslRef); > }else{ > my $driveNum = "1"; > #MysqlIt($server,$driveNum,%mslRef); > TestIt($server,$driveNum,%mslRef); > } > > </code> > > If /home2 is not returned from the ssh commnd I get the warning > > thanks in advance for the help. > > chad > -- > chad kellerman <[EMAIL PROTECTED]> > **** DISCLAIMER **** "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer". Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]