
wyndcrosser
Novice
Oct 9, 2012, 6:47 PM
Views: 1858
|
|
Re: [Laurent_R] Finding data in arrays
|
|
|
I have no clue what you guys are talking about, but this is how i ended up doing it. I'll erase the code from here soon so ppl can't copy it.
#for loop to support looking into the array from the last entry for ($i=$#studentID; $i>=0; $i--) { #pulls from the for loop looking for the search_key id within the studentID array if ($studentID[$i] == $search_key) { #exits the loop last; } } #if number is found, display the information for that array number. if ($i>=0) { print "\nStudent ID: \t@studentID[$i]"; print "First Name: \t@firstName[$i]"; print "Last Name: \t@lastName[$i]"; printf ("Amount Due: \t\$%1.2f", @amountDue[$i]); } #if not found, print name not found else { print "\nName not found.\n"; } Perl Newbie - 7 months of PERL basics.
(This post was edited by wyndcrosser on Oct 9, 2012, 7:34 PM)
|