Friday, February 4, 2011

PERL : Conditionals

touch ifthen.pl
#!/usr/bin/perl -w
if(conition)
{
# ==, <=, >=, <, >, gn, eq
my $value1 = 1;
my $value2 = 2;
my $firstname = "firstname";
my $lastname = "lastname";
if ($value1 <= $value2)
{
print "$value1 is <= that $value2";
}
else
{
print "$value1 is > that $value2";
}
elsif ($value1 <= $value2)
{
print "$value1 is > that $value2";
}


unless ($value1 < $value2) # prints if the condition is false
{
print "$value1 is > that $value2";
}
print "Bingo" if $value1 == $value2
}
#end

No comments:

Post a Comment