in reply to Re: Optimization of a piece of code(Is there a better way than this?)
in thread Optimization of a piece of code(Is there a better way than this?)

I don't find this obvious at all, as it behaves differently.

In the original code, if $Max_Questions is undefined, it gets a default value. In your code, if $Max_Questions isn't defined, you'll get two warnings, and it will croak with "Must have at least one question in the test.". The check on definedness of $Max_Question will not be reached if $Max_Question isn't defined.

I don't think there's much wrong with the original code, and I suggest leaving as it is.

Abigail

Replies are listed 'Best First'.
Re: Re: Optimization of a piece of code(Is there a better way than this?)
by suaveant (Parson) on Jul 08, 2002 at 14:25 UTC
    Ack... good point, my bad... I missed the obvious...

                    - Ant
                    - Some of my best work - (1 2 3)