Oct 7, 2012, 7:43 PM
Post #1 of 10
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%
Finding data in arrays
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.
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)