The repository contains a collection of different programming snippets to different programming languages from own developments as well as other projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
programming-examples/perl/String/The correct use of three of...

27 lines
605 B

#!/usr/local/bin/perl -w
# Do this forever.
for (;;)
{
print "Enter a word: ";
my $word1 = <STDIN>; chomp $word1;
print "Enter another word: ";
my $word2 = <STDIN>; chomp $word2;
if ($word1 eq $word2)
{
print "The two phrases are equivalent.\n";
}
elsif ($word1 lt $word2)
{
print "<$word1> is alphabetically less than <$word2>\n";
}
elsif ($word1 gt $word2)
{
print "<$word1> is alphabetically greater than <$word2>\n";
}
}