in reply to Re: Perl compare ( numeric in void isn't numeric)
in thread Perl compare

"1,2" is not "a number" or "a string" , its "a list", its two numbers separated by the comma operator

it's a list

my ($num1,$num2) = split (',',$number4); if ($num1 == 1 && $num2 == 2) {....

above code have no warning

Replies are listed 'Best First'.
Re^3: Perl compare ( numeric in void isn't numeric)
by choroba (Cardinal) on Sep 26, 2014 at 13:36 UTC
    It seems $number4 is not a list, it's a string. So, use string comparison eq and quote the string literals:
    if ($number4 eq '1,2') { # ... }
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^3: Perl compare ( numeric in void isn't numeric)
by GotToBTru (Prior) on Sep 26, 2014 at 14:33 UTC

    No, a scalar can not be a list. It is a string containing two digits separated by a comma.

    1 Peter 4:10