Perfect! It works great. Thank you very much!

Thanks Steve also, but I WANT warnings and all errors I can get as early as
posible!  =)

Regards,
SB.
----- Original Message ----- 
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 26, 2003 6:29 PM
Subject: Re: Use of uninitialized value in pattern match (m//) at ...


> Singing Banzo wrote:
> >
> > I think this is a very basic warning, but I coudn't find the way to
avoid it
> > (tried google, faq, and archive):
> >
> > Use of uninitialized value in pattern match (m//) at poComen.cgi line
138.
> >
> > line 138:
> > if ($q->param('template') =~ /^[1234]$/) {  # trying to find out if the
> > value of a form parameter is a digit between 1 and 4
>
> The warning means that the value of $q->param('template') is undef.
>
>
> > This only happens with "use strict".
> >
> > How can I get rid of it?
>
> if ( defined $q->param('template') and $q->param('template') =~
/^[1234]$/ ) {
>
>
> John
> -- 
> use Perl;
> program
> fulfillment
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

----- Original Message ----- 
From: "Steve Grazzini" <[EMAIL PROTECTED]>
To: "Singing Banzo" <[EMAIL PROTECTED]>
Sent: Thursday, June 26, 2003 6:06 PM
Subject: Re: Use of uninitialized value in pattern match (m//) at ...


> On Thu, Jun 26, 2003 at 04:28:49PM -0300, Singing Banzo wrote:
> >
> > Use of uninitialized value in pattern match (m//) at poComen.cgi line
138.
> >
> > line 138:
> > if ($q->param('template') =~ /^[1234]$/) {
> >
> > This only happens with "use strict".
>
> Are you sure?  :-)
>
> It would make more sense if it only happened with "use warnings".
>
> > How can I get rid of it?
>
> You could make sure $q->param('template') is defined before using
> it in the pattern-match.
>
> OTOH, if you don't care whether it's defined (and I think it's safe
> to say that you don't care *here* whether it's defined) then you can
> locally turn off the "uninitialized" warnings:
>
>     {
>         no warnings 'uninitialized';
>         if ($q->param('template') =~ /$pattern/) {
>             ...
>         }
>     }
>
> -- 
> Steve
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to