Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > command line input argv

Reply
Thread Tools

command line input argv

 
 
pop
Guest
Posts: n/a
 
      05-15-2006
Hi folks,

I have a certain output that I display on the terminal at the command
line and the user should make the choice and I send that output to
another perl file or throw an error and await output again
ex

1. file _one
2. file_two
pleae enter your choice : #@$$
Invalid entry
Please enter your choice : 1
<OUTPUT>

Iam trying to figure out the part from capturing the input and waiting
on the terminal for him to hit any choice. Can you guys give me a
pointer on what function is used here to wait. I know I can use argv to
capture the output.

How can I print the line "Please enter the choice " and wait for him
to enter any choice.

cheers
pop

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      05-15-2006
pop wrote:
> I have a certain output that I display on the terminal at the command
> line and the user should make the choice and I send that output to
> another perl file or throw an error and await output again
> ex
>
> 1. file _one
> 2. file_two
> pleae enter your choice : #@$$
> Invalid entry
> Please enter your choice : 1
> <OUTPUT>
>
> Iam trying to figure out the part from capturing the input and waiting
> on the terminal for him to hit any choice. Can you guys give me a
> pointer on what function is used here to wait. I know I can use argv to
> capture the output.
>
> How can I print the line "Please enter the choice " and wait for him
> to enter any choice.


print 'Please enter your choice: ';
chomp( my $input = <STDIN> );

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
Sumo Wrestler (or just ate too much)
Guest
Posts: n/a
 
      05-15-2006
pop wrote:
> [...]
> Iam trying to figure out the part from capturing the input and waiting
> on the terminal for him to hit any choice. [...]


my $input = <>;
print $input . "\n";


 
Reply With Quote
 
pop
Guest
Posts: n/a
 
      05-15-2006
Thanks guys.

pop.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
char **argv & char *argv[] jab3 C Programming 5 12-08-2004 08:15 AM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
difference(s) between char** argv and char* argv[] David C Programming 10 09-15-2003 06:58 AM
char **argv vs. char* argv[] Bret C Programming 21 09-03-2003 03:24 AM
sys.argv[0] - 'module' object has no attribute 'argv' =?ISO-8859-1?Q?Thomas_N=FCcker?= Python 0 06-30-2003 02:07 PM



Advertisments