programming-examples/perl/Basics/Getting Input in Perl Scripts.pl

14 lines
250 B
Perl
Raw Normal View History

2019-11-18 14:44:36 +01:00
# Note the extra space after the question mark.
print "What is your favorite scripting language? ";
$subLang = <STDIN>;
chomp($subLang);
if ( $subLang eq "perl" ) {
print "you chose perl!\n";
} else {
print "$subLang ";
}