Extend the if statement to include an else block
$lang = <STDIN>;
chomp($lang);
if ( $lang eq "perl" ) {
print "Congratulations, you choose perl!\n";
} elsif ( $lang eq "Tcl" ) {
print "Tcl is great, too.\n";
} else {
print "Well, use $lang if you feel ";
}
Related examples in the same category