![]() |
![]() |
![]() |
#!/usr/local/apps/perl/bin/perl
print "What is your name: ";
$name = <STDIN>;
chop( $name );
print "Hello, $name!\n";
print
Notice no \n (newline) at the end of the string
$name
Scalar variable (holds one value)
<STDIN>
Reads one line from standard input
chop
Function which strips last character (ie: "John\n"
-> "John")
WARNING: Most common Perl beginner bug...