in reply to removing leading 0's
OUTPUT: 0010 and 10 are equaluse strict; use warnings; chomp(my $x = <DATA>); chomp(my $y = <DATA>); #$x += 0; if($x == $y) { print $x . " and " . $y . " are equal\n"; } else { print $x . " and " . $y . " aren't equal\n"; } __DATA__ 0010 10
As numbers, they are equal. As strings, they are not! Note that your idea of adding zero would 'fix' the string.
|
|---|