- Standard in, or STDIN, is the default file handle for reading in text or data streams.
- Input can be handled like this:
$input =
where $input would store the input line. You can even store STDIN into a list as @linput line shows. You can continuously read in STDIN by:
@linput =while (<>) {
The above example shows the diamond operator in action. The diamond operator is the shorthand for
print $_;
}, and we are printing from the scratch list @_. - All prints are directed by default to Standard Out.
- Perl also provides a STDERR stream.
- You can use the C functions,
sprintf
andprintf
in Perl to format your text! Very powerful!
Monday, August 27, 2007
Input/Output :: Handling STDIN and STDOUT
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment