good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: special characters storage in perlby dreadpiratepeter (Priest) |
on Aug 05, 2009 at 13:24 UTC ( [id://786105]=note: print w/replies, xml ) | Need Help?? |
For starters, use strict would solve most of your problems, (but probably give you a host of new ones as you learn all the things you are doing wrong) You are using a global variable $index to loop with , which you are never initializing. therefore only the first call to this function has any chance of working correctly. How are you determining that $no_of_questions{$User_Name} is not being set properly? Are you saying that the loop never matches and the prints don't happen? or are you saying that they are and some unspecified test after that fact is not showing it? If you showed us the data and how you are calling the function, we could be of more help. (untested) should fix some of your more blatent coding problems, but I would want to eliminate the 2 global hashes and the global timestamp. Update: I think he calls his function multiple times to get all the results, not just the first. Updated my code sample to work right when called only once for all of them, (assuming 1 no_questions row for each username row). Of course this new version doesn't get the timestamp right, but his code is so screwy and reliant on globals that you can't have everything. -pete "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
In Section
Seekers of Perl Wisdom
|
|