Re: Can this be rewritten better?
- From: Joe Smith <joe@xxxxxxxxx>
- Date: Sat, 30 Apr 2005 03:49:17 -0700
Henry Law wrote:
if( param('select') and param('select') !~ /\.\./ )
I don't know what this is doing but it looks odd to me. I can't
imagine what the two calls to "param" are returning which when anded
together could ever look like ".."
They're not anded together. To perform an AND operation on two
integers require using & not && or 'and'. The quoted line translates
to "if param('select') is true (not undef, not '', not 0, not '0')
and the value does not contain two consecutive periods ...".
It probably makes more sense to write it as
if (defined param('select') and param('select') ~= /\.\./) { ... }
-Joe
.