LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bareword Found where operator expected (https://www.linuxquestions.org/questions/linux-newbie-8/bareword-found-where-operator-expected-838081/)

dbogo 10-14-2010 01:14 PM

Bareword Found where operator expected
 
$dec93 = 93;
$ser = SERVO;
$lbit = uc(sprintf("%02x\n", $dec93));
if($lbit == 5D){
print DATA "Byte11: $fbits11=$bstr11 Bits:[95-88]\t$ser\n";
}else{
sleep(1);
}

Why do I get this error?

Bareword found where operator expected at C:\Perl Scripts\Lbits.pl line 64, near "5D" (Missing operator before D?)

AlucardZero 10-14-2010 01:59 PM

Uh, quote your 5D.

dbogo 10-14-2010 02:20 PM

Quoting produced the following:

Argument "5D" isn't numeric in numeric eq (==) at C:\Perl Scripts\Lbits.pl line 64.
Argument "5D\n" isn't numeric in numeric eq (==) at C:\Perl Scripts\Lbits.pl line 64

but this did the trick:

if($lbit =~ /5D/)


All times are GMT -5. The time now is 04:11 PM.