Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Perl/Basics/User Input/STDIN"

From NetSec
Jump to: navigation, search
(Created page with "Reading from standard input in perl is very simple. {{code|text=<source lang="perl"> print "Enter your name :"; my $name = <>; print "Your name is $name\n"; </source>}}The <> ope...")
 
(No difference)

Latest revision as of 04:16, 16 July 2012

Reading from standard input in perl is very simple.

 
print "Enter your name :";
my $name = <>;
print "Your name is $name\n";
 
The <> operator, in this case, is used to read data from the command line. It will return after a newline character is received (when the user presses enter).