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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Finding data in arrays: Edit Log


Oct 7, 2012, 7:43 PM

Views: 6730
Finding data in arrays

I have finished all of my assignments for this semester, but this one. I'm way ahead in class, but arrays are not my thing... The following code is what I'm attempting to do. There are no comments yet, as I haven't gotten my code down 100%

There is a menu with three options. 1 is print out the amount of all students owed (sum of @amountDue).

Option 2 is ask for a student ID, if the ID is found print out the name, amount owed, and if the ID isn't found create data in the array with name,amount owed and studentID. Press "0" to back out option 2 menu and return to the main menu (options 1-3).

**option two is where I'm stuck**

Option 3 terminates the program.

I have tried numerous ways such as if statements for if ($temp ~~ @studentID) do blank. This works, but then I can't hit "0" to back out of the program. I have also tried using GREP to validate if data is present in the array. You'll see where $choice == 2 is where I'm having the difficulties at, I have grep there now, I was attempting to debug it. I'm guessing I'm going to need to use a for loop to validate the information in the array and pull from it.

Any support on this, or clarifications for identifying how to look into an array and print out information, would be greatly appreciated.

Also note down where is says "} while ($temp eq 0); "

I initially had until ($temp == 0); I was looking at ways to see why 0 wouldn't bring me back to the main menu.

Code erased.

if someone else if having issues with a similar project you can msg me there and ask.
Perl Newbie - 7 months of PERL basics.

(This post was edited by wyndcrosser on Oct 9, 2012, 6:48 PM)

Edit Log:
Post edited by wyndcrosser (Novice) on Oct 7, 2012, 7:53 PM
Post edited by wyndcrosser (Novice) on Oct 9, 2012, 6:45 PM
Post edited by wyndcrosser (Novice) on Oct 9, 2012, 6:45 PM
Post edited by wyndcrosser (Novice) on Oct 9, 2012, 6:48 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