On Jun 3, 2005, at 23:56, The Ghost wrote:

                     [EMAIL PROTECTED];

print "Answers:$surveyQuestions{answers}[$x]\n;   # <--- Prints the
number of answers instead

My problem is that I always get the number of answers instead of the
answers.  What am I doing wrong?

Perl structures can store just scalars. You need to pass an arrayref instead of an array, for instance this way:

    $surveyQuestions{answers}[$counter] = [ @answers ];

In your code @answers is being evaluated in scalar context, hence giving the number of answers.

See perldsc.

-- fxn


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to