Perl Menu Script

S

Simon

Hi guys!

Id like to learn about creating a menu in a perl script.

What Id like to do is the following.


============================================

Print "Press 1 for this subroutine";
Print "Press 2 for this subroutine";
Print "Press 3 for this subroutine";
Print "Press 4 for this subroutine";
Print "Press 5 for this subroutine";
Print "Press 6 for this subroutine";

Then the stdin is captured and goes to the right subroutine to execute.


Any help appreciated.
 
R

Randal L. Schwartz

Simon> Id like to learn about creating a menu in a perl script.

Simon> What Id like to do is the following.

Yeah, I'd like to get an "A" in class too, especially by cheating. Right.

Please don't post Homework problems here.
 
J

Josef Moellers

Simon said:
Hi guys!

Id like to learn about creating a menu in a perl script.

What Id like to do is the following.


============================================

Print "Press 1 for this subroutine";
Print "Press 2 for this subroutine";
Print "Press 3 for this subroutine";
Print "Press 4 for this subroutine";
Print "Press 5 for this subroutine";
Print "Press 6 for this subroutine";

Then the stdin is captured and goes to the right subroutine to execute.


Any help appreciated.

Putting aside what Randal wrote: This is not the place to ask for code,
this is the place to discuss code, so: post whatever you have tried and
we're glad to help you get/stay on the right track.

BTW: Don't assume your teachers are stupid.
 
T

Tim Southerwood

Simon said:
Hi guys!

Id like to learn about creating a menu in a perl script.

What Id like to do is the following.


============================================

Print "Press 1 for this subroutine";
Print "Press 2 for this subroutine";
Print "Press 3 for this subroutine";
Print "Press 4 for this subroutine";
Print "Press 5 for this subroutine";
Print "Press 6 for this subroutine";

Then the stdin is captured and goes to the right subroutine to execute.


Any help appreciated.

I honesly don't know if this is homework or not, so I'll give you some hints
in semi-good faith:

Have a look at ncurses and perl - you'll do a better job than the above and
it won't be hard.

Otherwise I would google for: "reading keypress perl" and, if you want to be
neat, subroutine references to achieve exactly what you outline.

Cheers

Tim
 
S

Simon

Hi Guys!

Dont know if any of you were waiting for a response from me...pretty sure
the first guy is :>)....amusing!
No need to dignify that first comment with any comeback...better things to
do :>)

Moving on....

We have a requirement at work for this and as such I will take on board your
guys' suggestions.

Thanku :>)
 
T

Tim Southerwood

Simon said:
Hi Guys!

Dont know if any of you were waiting for a response from me...pretty sure
the first guy is :>)....amusing!
No need to dignify that first comment with any comeback...better things to
do :>)

Moving on....

We have a requirement at work for this and as such I will take on board
your guys' suggestions.

Thanku :>)

Hi,

You have to understand that USENET gets a fair few postings that are
genuinely homework or university assignments.

Unfortunately, rightly or wrongly, your query fits the format.

USENET isn't a pay-for-professional-advice service, so people are free to
answer any way they like.

If you have a problem, post the code (minimal example to demonstrate the
problem) and I'm sure you will get many helpful responses.

Just the way it works.

Anyway, good luck with your project,

Tim
 

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

Forum statistics

Threads
474,202
Messages
2,571,058
Members
47,668
Latest member
SamiraShac

Latest Threads

Top