Francesco Scaglioni wrote at Wed, 25 Sep 2002 15:45:22 +0200:

> Typo in the copy not the original -- I think I misstated my question
> -- the error message in the log only occurs when there is no mollusc
> parameter ( sometimes there is sometimes there isn't ).  How can I
> check for the existance of a mollusc param and if so then untaint it,
> if it doesn't exist then no problem.  Without the re match the
> following gives no errors at any time
> 
>  my $mollusc     = ( param( 'mollusc'  )) || '';
> 
> compared with :
> 
> ( my $mollusc  ) = ( param( 'mollusc'  )  =~  /^(\w+)$/i );
> 
> which does.  The script actually works under both circumstances and
> with both lines of code.

It should as an undefined value is in string context an empty string.

You could also mix the syntax to avoid the warning and more
important to underline to the reader that this interpretation is wanted with

my ($mollusc) = (param('mollusc') || '') =~ /^(\w+)$/;


BTW: The i-modifier doesn't seem to be necessary,
     as you are matching word characters which are also
     the upcase as also the lowercase ones.


 
Greetings,
Janek


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

Reply via email to