S.Marion said:
I want to compare 2 hexadecinal numbers.
Consider this example:
my $var1 = "0x00d9";
my $var2 = 0x00d9;
You do not have two hexidecimal numbers. You have one hexidecimal
number and one string.
if ($var1 != $var2){
print "Yep, you get the point... it's not equal, which is my problem!!\n";
}
The perl runtime complains about this comparison.
That means you're enabling warnings. Very good!!
How can I force perl to compare?
I tried things like int($var) or $var += 0 but with no luck.
Throwing things at the wall to see what sticks is rarely a good idea
when programming. Instead, read the documentation.
You are obviously having problems with representations of your data.
Therefore `perldoc perldata` seems a likely candidate for documentation
to read which would solve your problem...
==================================================
Scalar value constructors
Numeric literals are specified in any of the following
floating point or integer formats:
12345
12345.67
.23E-10 # a very small number
4_294_967_296 # underline for legibility
0xff # hex
0377 # octal
0b011011 # binary
String literals are usually delimited by either single or
double quotes. They work much like quotes in the standard
Unix shells: double-quoted string literals are subject to
backslash and variable substitution; single-quoted strings
are not (except for "\'" and "\\"). The usual C-style
backslash rules apply for making characters such as newline,
tab, etc., as well as some more exotic forms. See the Quote
and Quote-like Operators entry in the perlop manpage for a
list.
Hexadecimal, octal, or binary, representations in string
literals (e.g. '0xff') are not automatically converted to
their integer representation. The hex() and oct() functions
make these conversions for you. See the hex entry in the
perlfunc manpage and the oct entry in the perlfunc manpage
for more details.
====================================================
Paul Lalli