|Problems? Is your data what you think it is?|
Re: Help with getting the ouput from the scriptby greengaroo (Hermit)
|on Jun 03, 2013 at 17:51 UTC||Need Help??|
Fellow monks, please, for a simple question, give a simple answer.
Monk freekngeek, what you want to do is to read from the command-line from your script. This is part of the input/output chapter. The output part, you probably know already. When you use the print function, you use the output.
To use the input and output in Perl, you need what is called "FileHandles". The print function uses a default FileHandle named "STDOUT" (Standard Output).
You want to read from the STDIN (Standard Input). How to do that? Try this:my $a = <STDIN>;
It will give the same result as Monk hippo mentioned above. In his example, the STDIN FileHandle was implied, the same way the STDOUT FileHandle is implied when you use the print function:print "Hello world";
Is the same as:print STDOUT "Hello world";
Of course, you can use CPAN modules to achieve reading from the command-line, like Monk davido mentioned above, but I suggest before you venture in that direction, that you learn the basics of Input/Output in Perl. Search for "FileHandle" and "STDIN" and you shall find your answers.