Hi there. Thanks for taking the time to read this question. It's probably something I'm missing on my part. Anyways, onto the question.
I'm working on an address book and storing the records via hashes. I want the users to be able to search for an address by using the contact number. Here's the code I came up with:
print "\nEnter the number you wish to search for";
@LIST = grep($phoneSearch ,%addresses); #searches for records that have
#the specified number and
#assigns it to @LIST
if (@LIST != null) #checks if results are found
$#LIST = -1; #empties out array for reuse}
print "No records found...";}
The problem with this code? The array doesn't empty itself after it prints the array. So even though the user specifies a phone number not in the records, it will output the array regardless. Any help will be greatly appreciated.