Hi All,
I have a uninitialized variabe $tmp. How can I check if the variable is initialized are not.I want to catech the warning without suppressing it using no warnings qw( uninitialized ). Please tell me how can I do it.
The above code I used but I cant able to catch the warning.
but I got the output.
output:
Use of uninitialized value in string eq at tmp.txt line 8.
Use of uninitialized value in string ne at tmp.txt line 10.
XYZ
I have a uninitialized variabe $tmp. How can I check if the variable is initialized are not.I want to catech the warning without suppressing it using no warnings qw( uninitialized ). Please tell me how can I do it.
Code:
my $tmp; my $var; $var = "raghu"; if ( $tmp eq "" ) { if ($tmp ne $var) { print " XYZ \n"; } }
but I got the output.
output:
Use of uninitialized value in string eq at tmp.txt line 8.
Use of uninitialized value in string ne at tmp.txt line 10.
XYZ
Comment