I have a problem in interpreting the bytes from binary file in perl.
Snippet of the code :
open IMG_FH, $IMAGE_FILE or die $!;
binmode IMG_FH;
sysread(IMG_FH, $Var_Options, 2);
if ($Var_Options == 0)
{
print "Received 0\n";
}
elsif ($Var_Options == 28)
{
print "Received 0\n";
}
else
{
print "Error\n";
}
Even though I am sure that the word kept at the start of the binary file is : "001c" (Hexadecimal), I am ending up printing "Error";
Please help.