Getting Input in Perl Scripts : Command Line « Language Basics « Perl
- Perl
- Language Basics
- Command Line
Getting Input in Perl Scripts
# Note the extra space after the question mark.
print "What is your favorite scripting language? ";
$lang = <STDIN>;
chomp($lang);
if ( $lang eq "perl" ) {
print "you chose perl!\n";
} else {
print "$lang ";
}
Related examples in the same category