You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
540 B
Perl

# if (Expression) {Code Segment}
# if (Expression) {Code Segment} else {Code Segment}
# if (Expression) {Code Segment} elsif {Code Segment} ... else {Code Segment}
#!/usr/local/bin/perl -w
while (<STDIN>)
{
chomp;
if ($_ < 10)
{
print "$_ is less than 10.\n";
}
elsif ($_ < 20)
{
print "$_ is between the values of 10 and 19.\n";
}
else
{
print "$_ is greater than or equal to 20.\n";
}
}