in reply to Re^4: perl unpack and matching the unpacked data
in thread perl unpack and matching the unpacked data
... what i tried was actually:
elsif ( $data eq "8000" || "0080" ) { $tid = .....; }
As you discovered, this syntax doesn't work — at least, not the way you expected: the truth value of the expression $data eq '8000' is logical-ored with '8000'. Again, let Perl help you:
c:\@Work\Perl\monks>perl -wMstrict -MO=Deparse,-p -le "my $data = '8000'; ;; if ($data eq '8000' || '0080') { print 'yes'; }; " BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use strict 'refs'; (my $data = '8000'); if ((($data eq '8000') or '0080')) { print('yes'); } -e syntax OK
|
|---|