in reply to Re: multiple values and CGI.pm
in thread multiple values and CGI.pm

Sorry, but example you provide doesn't work as expected too.
All I managed to get from it was two empty textfields.
Also, I was unable to print $values[0], $values[1] like this:
#!/usr/bin/perl -w use CGI qw/:standard/; if (param) { my @values = param('name'); } print header, start_html, start_form; print textfield(-name=>'name', -default=>$values[0], -override=>1); print textfield(-name=>'name', -default=>$values[1], -override=>1); print submit, end_form, $values[0], $values[1], end_html;
Have you tried it before?

Replies are listed 'Best First'.
(tye)Re: multiple values and CGI.pm
by tye (Sage) on Mar 22, 2001 at 19:46 UTC

    Your first problem is that you didn't use strict. Fixing that will probably give you a big clue about your second problem.

    Your "my @values" makes that @values scoped local to the block of the if statement so that your other uses of @values are using a different, undeclared, empty array.

            - tye (but my friends call me "Tye")