Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Perl provides two sets of comparison operators: one set for working with numbers and one set for working with strings.

Numbers

Strings

==

eq

!=

ne

<

lt

<=

le

>

gt

>=

ge

<=>

cmp

Do not use the number comparison operators on nonnumeric strings. Likewise, do not use the string comparison operators on numbers.

...

Confusing the string comparison operators with numeric comparison operators can lead to incorrect program behavior or incorrect program data.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

EXP35-PL

Low

Likely

Low

P9

L2

Automated Detection

Tool

Diagnostic

Perl::Critic

ValuesAndExpressions::ProhibitMismatchedOperators

Security Reviewer - Static Reviewer

DoubledPrefix

Bibliography

...


...

Image Modified Image Modified Image Modified