On Sat, Jun 09, 2001 at 08:37:22PM +1000, iain truskett wrote:
> $previous = $ENV{HTTP_REFERER} ? $ENV{HTTP_REFERER} : 'an unknown site';
>
> Only one use of the variable name, thus easier to maintain =)
>
> Of course, there is a sideeffect in both this, the original and the one
> the original is based upon:
> + If there was no key 'HTTP_REFERER' in %ENV, then there is now
> (albeit undefined).
As it happens, this is not the case.
> Hence, you may really want:
>
> $previous = exists($ENV{HTTP_REFERER}) && length($ENV{HTTP_REFERER})
> ? $ENV{HTTP_REFERER}
> : 'an unknown site';
But you still probably really want:
my $previous = $ENV{HTTP_REFERER} || "an unknown site";
[ At least you got rid of those horrible quotes around HTTP_REFERER though. ]
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net