>
> I know there is a much simpler way to do this. What this does is check
a URL
> written with and without www. or trailing / against a list of urls
that (one
> at a time) are placed in $siteurl2.
>
> $FORM{'siteurl'} is the site url being submitted.
> $alternativeurl is $FORM{'siteurl'} without the www. if with.
> $xalternatives is $FORM{'siteurl'} with the www. if without.
>
> This works ok it seems, but it's horrible code. There must be a better
way to
> write this. Any help will be appreciated.
>
> if (($FORM{'siteurl'} =~ /$siteurl2$/) || ($FORM{'siteurl'} =~
> /$siteurl2\/$/) || ($alternativeurl =~ /$siteurl2$/) ||
($alternativeurl =~
> /$siteurl2\/$/) || ($xalternatives =~ /$siteurl2$/) || ($xalternatives =~
> /$siteurl2\/$/)) {
> print "Found 1 \n";
> }
>
>
I am not entirely sure I follow but does this do it?
if ($siteurl2 =~ /^(?:www.)?$FORM{'siteurl'}\/?$/) {
print "Matched";
}
Aka optionally 'www.' followed by the submitted URL, with an optional
trailing slash.
If not come back and someone will get you sorted.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>