Example 5-4. examples/scalars/read_from_stdin_chomp.pl
#!/usr/bin/perl use strict; use warnings; print "Enter your name, please: "; my $name = <STDIN>; chomp $name; print "Hello $name, how are you ?\n";
chomp will remove the new line "\n" character from the end of the string if there was one.
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| User Input | Up | Numerical Operators |