command line input argv

P

pop

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
 
G

Gunnar Hjalmarsson

pop said:
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> );
 
S

Sumo Wrestler (or just ate too much)

pop said:
[...]
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";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top