CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [wyndcrosser] Finding data in arrays: Edit Log



FishMonger
Veteran / Moderator

Oct 7, 2012, 9:16 PM


Views: 2870
Re: [wyndcrosser] Finding data in arrays

Since this is for a course homework assignment, I can't/won't give you the code, but I can/will give you some guidance.

There are several ways to approach this problem, but IMO, the best approach would be to use a dispatch table. A dispatch table is a hash where the keys are the menu options and the value of each of them point to a code reference, (i.e., a reference to a subroutine that is executed when that option is entered).

You need 4 subroutines for the dispatch table. One for each menu option and one "default" to handle invalid input.

After prompting/accepting the user's selection, you sanitize it as needed and compare it against the hash keys and execute the appropriate subroutine.

I'm not going to provide the actual code or reference links, because finding that out is part of your task in completing the assignment.

If/when you get stuck, you can post specific questions along with your code and we will help where we can, without doing your homework for you.


(This post was edited by FishMonger on Oct 7, 2012, 9:22 PM)


Edit Log:
Post edited by FishMonger (Veteran) on Oct 7, 2012, 9:22 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives