P
praveen.kane
Perl if statements evaluates wrongly if we use '=>' as operator
Steps to reproduce :
---------------------------
1. Try to compare the scalar value using '=>' operator (comma
operator)
Below is the Perl code where issue will able to reproduce.
___________________________________________
#!/usr/bin/perl
$count = 10;
print "Count value : 10 \n";
if ($count => 20) {
print "Count value is greater than 20 \n ";
}else {
print "Count value is less than 20 \n";
}
___________________________________________
OutPut :
___________________________________________
[root@osdc-pxe001 pramuSUITE]# perl new1.pl
Count value : 10
Count value is greater than 20
[root@osdc-pxe001 pramuSUITE]#
___________________________________________
Observation:
-------------------
1. Perl expression using '=>' operator is returning true/
1 ,irrespective of condition .
2. Successfully complete execution and executes if block irrespective
of condition.
we expect :
Steps to reproduce :
---------------------------
1. Try to compare the scalar value using '=>' operator (comma
operator)
Below is the Perl code where issue will able to reproduce.
___________________________________________
#!/usr/bin/perl
$count = 10;
print "Count value : 10 \n";
if ($count => 20) {
print "Count value is greater than 20 \n ";
}else {
print "Count value is less than 20 \n";
}
___________________________________________
OutPut :
___________________________________________
[root@osdc-pxe001 pramuSUITE]# perl new1.pl
Count value : 10
Count value is greater than 20
[root@osdc-pxe001 pramuSUITE]#
___________________________________________
Observation:
-------------------
1. Perl expression using '=>' operator is returning true/
1 ,irrespective of condition .
2. Successfully complete execution and executes if block irrespective
of condition.
we expect :