![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Comparison | Strings | Numbers |
|---|---|---|
| Equality | eq | == |
| Inequality | ne | != |
| Greater than | gt | > |
| Greater than or equal to | ge | >= |
| Less than | lt | < |
| Less than or equal to | le | <= |
| Comparison
returns -1,0,1 | cmp | <=> |
You can build up conditionals using && (AND) and ||
(OR) operations.
Truth is a very flexible value in perl:
#### Some examples of truth:
1; # traditionally
("a","b"); # the list has elements
" "; # whitespace is true
"hello"; # strings are true
"00" # a string
#### Expressions that evaluate to false
0; # traditionally
(); # the empty list
""; # the null string
"0"; # The one string of non-zero length that is false.
![]()
The National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign
[email protected]
Last modified: June 19, 1997