in reply to Re: Urgent help needed by inexperienced programmers
in thread Urgent help needed by inexperienced programmers

The external file sounds like a good idea, you'd need to keep the ID number in each of the pages so you can match it up w/ the user at the end ... not secure, of course. I can put a number in my hacked copy of your script too.

There's been lots of discussion on why $$1 = ... is a *bad* idea; generally it means you're looking at the wrong end of the problem. You could do:

foreach $val @params { if ($val =~ /^question(\d+)/) { $questions[$1] = $q->param($val); } }
which'd give you the question vals in an array, indexed by N but ... that's only slightly better. Overwrites if N is in there twice, etc.

a

Replies are listed 'Best First'.
Re: Re: Re: Urgent help needed by inexperienced programmers
by PsychoSpunk (Hermit) on Dec 07, 2000 at 05:29 UTC
    I'd never do it that way. I was just providing a method that would meet spec. There's not even a reason to do what you're suggesting since it's duplication of data (ie - memory issues). But, some caveats to your code. We don't know if N will be integer. We presume it will be, but what about cases 1a, 1b, 1c?

    Furthermore, my code has that problem in the case where $1 = 1. in which case you're evaluating ${$1} -> $1 -> 1;

    My answer was to generally push these guys in the direction proper, and your reply shows why my initial thought of stripping question from N is bad. I hadn't seen that before a, thanks.

    It appears that a lot of people use the ID number, since it appeared on another post as magic cookie. I left a lot of my answer open ended since this is a group project for school, and I think they should be forced to use their heads a little. You are correct about the ID being stored on the questionnaire page, but I figured that it was obvious.

    ALL HAIL BRAK!!!