my $name = param('name') || '';
if(defined $name) {
# if its valid , HTMLescape it and print it
# otherwise tell them they did bad :)
}
else {
# ask them for theri name
}
definitely the better way to handle it, although you don't need
the || unless you want a default value.
Anthony Ettinger wrote:
my $name = param('name') || '';
if(defined $name) {
# if its valid , HTMLescape it and print it
# otherwise tell them they did bad :)
}
else {
# ask them for theri name
}
definitely the better way to handle it, although you don't need
the || unles
Hello,
Use of uninitialized value in concatenation (.) or
string at cgi_7.pl line 31.
This is your name
Use of uninitialized value in concatenation (.) or
string at cgi_7.pl line 35.
Line 31 and 35 are using data that in uninitialized.
For instance calling param() on a parameter that has not
>Dear Dr. Ruud,
>
>Thanks it works. I change this line into:
>
>my $name = ($query_obj->param('text_field') or ' ');
>But I am not sure why I need to add the (or ''). I
>see nowhere in CGI.pm talking about it. Can you
>explain it in a liitle bit detail? Also what am I
>supposed to do if
--- "Dr.Ruud" <[EMAIL PROTECTED]> wrote:
> chen li schreef:
>
> > my $name=$query_obj->param('text_field');
> > print $query_obj->p,"This is your name $name",
> > "\n\n"; #line31
> > [...]
> > Use of uninitialized value in concatenation (.) or
> > string at cgi_7.pl line 31.
>
>my $name
chen li schreef:
> my $name=$query_obj->param('text_field');
> print $query_obj->p,"This is your name $name",
> "\n\n"; #line31
> [...]
> Use of uninitialized value in concatenation (.) or
> string at cgi_7.pl line 31.
my $name = ($query_obj->param('text_field') or 'Joe?');
--
Affijn, Ruu
chen li wrote:
: I just try a small CGI script. Although it displays no
: problem on the webpage there are two small errors in
: the script. I wonder if anyone here can help me figure
: out.
[snip helpful code]
: my $name=$query_obj->param('text_field');
: print $query_obj->p,"This is your name