I am trying to collect the values from the a cgi form and creating a file. Earlier I used to have only one text field, so using param I was collecting the params, but now I am adding one more and trying to collect the values from those 2 fields. Here is snippet from the cgi form.
print $q->start_table;
&first_process;
foreach (@comment) { #array starts here
($jobname, $element, $comment)= split /\|/;
my $element_drop=$element . "_drp";
print $q->Tr(
$q->td($jobname),
$q->td(
$q->textfield(-name => $element, -size => 50, -default=> $
+comment)
),
$q->td(
$q->popup_menu(-name => $element_drop, -values => ['N/A','
+Infra Issue','UpStream Delay','Teradata Issue', 'AbInitio Issue','Oth
+ers'], -default => 'N/A', -labels => \%cause_opt )
)
);
In the action page, I am collecting the params like this"
my %params = $q->Vars;
my @hash_array_keys=keys %params;
my @hash_array_values=values %params;
open FILEHANDLE, ">/tmp/hash.dat" or die "Can not open hash.dat";
$, = "\n";
for my $k (sort @hash_array_keys)
{
print FILEHANDLE $k, $params{$k};
}
#print FILEHANDLE values %params;
close FILEHANDLE;
But I need the file in the format
textfield1|popup_menu1
textfield2|popup_menu2
textfield3|popup_menu3
Is there any way to achieve this? I tried printing the hash values but they are not coming in order.
Thanks In advance.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.