$q{'command'} =~ /^(search|\s*)$/; $command = $1; # $command is now untainted. #### defined $command && $command eq 'search' ? &search : &main; # gosh, I love the trinary operator :) #### while ($firstDisp < $lastDis) {...} #### use CGI; my $q = new CGI; #### $q->param('command') =~ /^(search|\s*)$/; # untaint 'command' my $command = $1; # $command is now untainted.