Perl Programming Help Please!?

  • Thread starter Thread starter Izzy
  • Start date Start date
I

Izzy

Guest
I have a menu and I need the user to select an option. So for example:
1) add
2) subtract
3) multiply
4) divide
5) exit
($num=<stdin>;)

How do I have this break up into groups for more detail without doing:

if ($num=1);
{
stuff
}
elsif ($num=2)
{
other stuff
}
etc...

I need to do this using Functions. How is this done? I was trying with the "sub" function but couldn't figure it out.

Best answer will receive 10 points!
 
Back
Top