Read User Input
- When you use <STDIN>, Perl replaces it with a line of text from the standard input
- $color = <STDIN>;
- chomp($color);
- print "Where's my $color hat?\n";
- Use the built-in chomp() function to get rid of the newline
- chomp($color);
| CPU: Perl, Fall 2005 | Perl, Week 1: Intro to Perl, Scalars | #26 |
| Copyright © 2005 Ian Langworth |