# File: compare.pl # Title: Input from keyboard two strings # Compare strings. Do this until you want to. Continue(y/n)? = # Author: Mihaela Malita # Input first string? Mel # Input second string? Melanie # Compare strings Mel with Melanie # They NOT are equal # Mel is less than Melanie # Continue(y/n)? n # Bye $yesorno = 'y'; while($yesorno eq 'y' or $yesorno eq 'Y' ) { #is Y or y print "Input first string? "; $s1 = ; chop($s1); print "Input second string? "; $s2 = ; chop($s2); print("Compare strings $s1 with $s2 "); if ($s1 eq $s2) {print "\nThey are equal";} if ($s1 ne $s2) {print "\nThey NOT are equal";} if ($s1 lt $s2) {print "\n$s1 is less than $s2";} if ($s1 gt $s2) {print "\n$s1 is greater than $s2";} print("\nContinue(y/n)? "); $yesorno = ; chop($yesorno); } print "Bye"; exit;