On Tue, Nov 01, 2005 at 04:34:45PM +0100, Adedayo Adeyeye wrote:

> I'm getting an error when trying to run a script. Part of the scripts is

> my $action = param('form_action');
> if($action eq 'search');

> The error I get is:
> Use of uninitialized value in string eq at connect_rodopi.cgi line 14. 

Looks more like a warning then an error to me.

> How am I supposed to initialize this value?

By assigning something to it, but in this case its possibly better to
test if something was assigned to it.

if (defined $action && $action eq 'search') ...

or 

if (!defined $action) {
  ...
} elsif ($action eq 'search') {
  ...
} 

-- 
David Dorward                                      http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to