Hi Masayoshi,
On Sat, May 18, 2013 at 12:51 AM, Masayoshi Fujimoto <
[email protected]> wrote:
> Hi
> Please help me.
> I can only see Hilary Duff.
> I can not see Taylor Momsen.
> I would like to use table for that.
> How should I do?
>
> ## Here is my script.
> #!/usr/bin/perl
> use Modern::Perl;
> use autodie;
> use CGI;
>
>
> my $q = CGI->new;
>
> my %label = (
> celeb => 'Who do you fancy? : ',
> );
>
> my %form = (
> celeb => $q->radio_group(-name=>'celeb',
> -values=>['Hilary
> Duff','Taylor Momsen'],
> -default=>'Hilary Duff'),
>
The line above gives a warning message: Odd number of elements in hash
assignment.
You can re-write that like so:
my $radio = $q->radio_group(
-name => 'celeb',
-values => [ 'Hilary Duff', 'Taylor Momsen' ],
-default => 'Hilary Duff');
my %form = (
celeb => $radio,
submit => $q->submit,
reset => $q->reset,
);
> say $q->header;
> say $q->start_html;
> say $q->start_form;
> say $q->table(
> $q->Tr([
> $q->td([$label{celeb},$form{celeb}]),
> $q->td([$form{submit},$form{reset}]),
> ])
> );
> say $q->end_form;
> say $q->submit;
> say $q->end_form;
> say $q->end_html;
>
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
--
Tim