programming-examples/perl/Statement/The Switch.pm Module.pl

12 lines
347 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use Switch;
print "What is your favorite color? ";
chomp($color=<STDIN>);
switch("$color"){
case "red" { print "Red!\n"; }
case "blue" { print "blues.\n"; }
case "green" { print "green\n";}
case "yellow" { print "yellow";}
else { print "$color is not in our list.\n";}
}
print "Execution continues here....\n";