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

Perl/Basics/User Input/STDIN

From NetSec
Revision as of 03:16, 16 July 2012 by AlizaLorenzo (Talk | contribs) (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...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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).