If the script is running from the command line, you can use something like the following:
#!/usr/bin/perl -w
use strict;
print "Enter something: ";
my $response = <STDIN>;
print "You entered: $response";
If you don't want the newline on the end of $response, don't forget to chomp it.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats. | [reply] [d/l] |
Thanks, OvidinExile!
You've just confirmed my basic problem: I'm running this program off the browser and it seems I need to be running directly from the command line. Where are the instructions for command-line running? The only way I knew to operate was with a Perl/CGI script through my browser.
(I've just downgraded myself to Newbie minus minus.)
Thanks for your patience...
laura
| [reply] |
lauragarcia wrote:
I'm running this program off the browser and it seems I need to be running directly from the command line.
I'm not sure I follow you. Is this supposed to be a CGI script? Is this a program someone else wrote and you are using?
If it's a relatively short program, perhaps you can post it here? Or perhaps you know enough to identify the relevant section of code and you can post that here? If so, be sure to wrap it in <CODE></CODE> tags so that the formatting is preserved.
The reason I can't answer your question directly is due to lack of information. If it's a CGI script, I need to give you information about using CGI.pm to get the data. If it's a command line program, is it expecting command line arguments or does it want to read the data from STDIN? Seeing the appropriate code sections can give us better insight as to your needs.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] |