How to select 10 questions out of 20 in an array and i only want each question once
i have -
sub BuildFeedbackPage{
-
my @questions = &Questions(10);
-
print hr, $1, br;
-
print radio_group(-name=>'question1', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $2, br;
-
print radio_group(-name=>'question2', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $3, br;
-
print radio_group(-name=>'question3', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $4, br;
-
print radio_group(-name=>'question4', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $5, br;
-
print radio_group(-name=>'question5', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $6, br;
-
print radio_group(-name=>'question6', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $7, br;
-
print radio_group(-name=>'question7', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $8, br;
-
print radio_group(-name=>'question8', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $9, br;
-
print radio_group(-name=>'question9', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, $10, br;
-
print radio_group(-name=>'question10', -values=>['very bad', 'bad', 'average', 'good', 'very good'], -default=>'average', -linebreak=>'true', -labels=>\%labels); #radiobuttons group 1 - 5
-
print hr, &MakeSubmitButton('Finished');
-
}
-
sub Questions{
-
my $1 = '';
-
my $2 = '';
-
my $3 = '';
-
my $4 = '';
-
my $5 = '';
-
my $6 = '';
-
my $7 = '';
-
my $8 = '';
-
my $9 = '';
-
my $10 = '';
-
my $11 = '';
-
my $12 = '';
-
my $13 = '';
-
my $14 = '';
-
my $15 = '';
-
my $16 = '';
-
my $17 = '';
-
my $18 = '';
-
my $19 = '';
-
my $20 = '';
-
-
my @questions = '$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20';
-
for(my $i=0; i<10; i++)
-
{
-
if(
-
my @return += int(rand(@questions));
-
-
}
-
return @return;
-
}
-
sub GetRating{
-
my $0 = shift;
-
my $1 = shift;
-
my $2 = shift;
-
my $3 = shift;
-
my $4 = shift;
-
my $5 = shift;
-
my $6 = shift;
-
my $7 = shift;
-
my $8 = shift;
-
my $9 = shift;
-
my $rating = ((($0 + $1 + $2 + $3 + $4 + $5 + $6 + $7 + $8 + $9) * 2) / 10);
-
return $rating;
-
}
-
sub StoreRatingToFile{
-
my $rating = GetRating(param('question1'), param('question2'), param('question3'), param('question4'), param('question5'), param('question6'), param('question7'), param('question8'), param('question9'), param('question10'));
-
my $email = #hidden textfield containing email address from log in
-
open(OUTFILE, ">>", "$outfile");
-
print OUTFILE "$rating : $email";
-
close OUTFILE;
-
}
-
1 1372
10 random entries? Use shuffle from List::Util and then select first 10.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dr. zoidberg |
last post by:
Hello,
I have mysql table:
+----+---------+
| 1 | value1 |
+----+---------+
| 2 | value2 |
+----+---------+
| 3 | value3 |
|
by: its me |
last post by:
Let's say I have a class of people...
Public Class People
Public Sex as String
Public Age as int
Public Name as string
end class
And I declare an array of this class...
|
by: Fabian Wauthier |
last post by:
Hi list,
I am trying to dynamically grow a 2 dimensional array (Atom ***Screen) of
pointers to a struct Atom (i.e. the head of a linked list). I am not
sure if this is the right way to do it:
...
|
by: george r smith |
last post by:
I am converting a delphi chess program to C#, this is how I study a new
language and I have the following problem.
How do you use an enumeration value as an indexer for an array ?
This is what I...
|
by: Markus S. |
last post by:
Hello!
I have two questions about Socket.Select():
1) How is it possible to interrupt Socket.Select()? I'm calling
Socket.Select() in a worker thread. When new sockets are added (from another...
|
by: Jake Thompson |
last post by:
Hello
I have the following defined structure
struct cm8linkstruc
{
char *type; /* type of item*/
char *desc; /* description of item ...
|
by: Madhu |
last post by:
I would like to know how the following will be handled in the .net
framework:
Pl. don't pay attention to the syntax
int a
int b
a=2
a=2
a=2
|
by: Martien van Wanrooij |
last post by:
I have been using for a while a class to create photo albums. Shortly, an
array of photo's is declared, initially they are shown as thumbnails, by
clicking on a thumbnail a larger photo is shown...
|
by: DR |
last post by:
is there any speed difference between a TVF CLR that returns an array vs
yield as each result is ready? e.g. does returning the array all at once
cause sql server to allocate more efficiently?
|
by: bonneylake |
last post by:
Hey Everyone,
Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section.
...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |