| |
Comparison Operators listing |
|
#! /usr/local/bin/perl
$booleanResult = (4 == 4);
print ' 4 == 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 == 4);
print ' 3 == 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (4 != 4);
print ' 4 != 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 != 4);
print ' 3 != 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (4 < 4);
print ' 4 < 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 < 4);
print ' 3 < 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (5 < 4);
print ' 5 < 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (5 > 4);
print ' 5 > 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 > 4);
print ' 3 > 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (4 > 4);
print ' 4 > 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (4 >= 4);
print ' 4 >= 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 >= 4);
print ' 3 >= 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (5 >= 4);
print ' 5 >= 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (4 <= 4);
print ' 4 <= 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (5 <= 4);
print ' 5 <= 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 <= 4);
print ' 3 <= 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (4 <=> 4);
print ' 4 <=> 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (3 <=> 4);
print ' 3 <=> 4; Results in ';
print "booleanResult = $booleanResult\n";
$booleanResult = (5 <=> 4);
print ' 5 <=> 4; Results in ';
print "booleanResult = $booleanResult\n";
Operator Example Description
== $a == 4; Equal to
!= $a != 4; Not equal to
< $a < 4; Less than
> $a > 4 ; Greater than
>= $a >= 4; Greater than or equal to
<= $a <= 4 ; Less than or equal to
<=> $a <=> 4 ; Compare
|
|
|
Related examples in the same category |
|