On Tue, 29 Mar 2005, Chris Heiland wrote:
> Untested:
>
> if ($query->request_method() =~ m/^post$/i) {
> do something;
> }
If you're matching against a known, fixed pattern, the string comparison
operators will almost always be faster and clearer than the equivalent
regex. In this case, the method is always going to be one of POST, GET,
HEAD, etc, so it's much better to use the string comparison operator.
if $query->request_method() eq 'POST' {
do_something();
}
(And of course, don't use the numerical comparison operators, because
we're dealing here with strings, not numbers.)
--
Chris Devers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>