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 || unless you want a default value. Setting it as empty is still a
yeah, I did || ''; so his uninitialized value woudl go away, but in that case the
if(defined $name) could just be if($name)
value, so you potentially could have empty values in your database. if
Thats what the "if its valid" part is for :)
(defined($name)) would be better, but can be rather cumbersome.
Actually it not that cumbersome (all the parens look really bad IMHO...), just change || ''; to ; above and voila "fool" proof and it looks slick! :)
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
