Reading from STDIN
#STDIN, STDOUT, and STDERR refers stdin, stdout, and stderr.
#By default, these filehandles are associated with your terminal.
#When printing output to the terminal screen, STDOUT is used.
#When printing errors, STDERR is used.
#When assigning user input to a variable, STDIN is used.
#The Perl <> input operator encloses the STDIN filehandle.
#The next line of standard input can be read from the keyboard.
#If you don't want the newline, then you have to "chomp" it off.
# Getting a line of input from the keyboard.
print "What is your name? ";
$name = <STDIN>;
print "What is your father's name? ";
$paname=<>;
print "Hello respected one, $paname";
Related examples in the same category