Dave Smith wrote:
> 
> Howdy,
> 
> I'm trying to write a program that will redirect people looking at a
> site using Netscape 4.  (I have a header that looks good in Mozilla,
> Netscape 6, and IE, but looks pretty crappy in Netscape 4). 
> 
> I'm new at programming, and am still reading Elements of Programming
> with Perl, so please go easy on me.
> 
> I've tried this, thinking the regex would look for Netscape 4, and
> redirect but I'm missing something.  It's not working. 
> 
> I'm not sure if I should just code a separate page for Netscape 4, or
> if I should try to put something in the cgi that if it is a Netscape 4
> browser it should use a different set of header commands.
> 
> Thanks in advance,
> 
> --Dave
> 
> 
> #! /usr/local/bin/perl

No space after #!...
use strict and use warnings are suggested.

Then you need to have a look at perldoc -f open

Essentially you need to read in the file that you want to print before 
you just start printing it, which is what "open" will help you with. 
Are you sure the problem isn't this instead of your regex failing?

After having a look at open see if you still have questions....

http://danconia.org

> 
> print "Content-type: text/html\n\n";
> 
> if ($ENV{'HTTP_USER_AGENT'} =~ /Mozilla 4/
>     and not $ENV{'HTTP_USER_AGENT'} =~ /compatible/i ) {
>     print <surly.cgi>;
> } else {
>     print <tipsy.cgi>;
> }
> 
> 
> 
> 
> 
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to