[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re:[MacPerl] my first script, what's wrong?



At 11:58 AM 10/20/96, Adam Berns wrote:
> Well, I have gotten my almost first useful script, but It is not working
> correctly.

Here, try this:

#!/usr/local/bin/perl
# Put the first number after "Mozilla" into the variable $1, then test $1
$ENV{'HTTP_USER_AGENT'} =~ /.*Mozilla\s*(\d*).*$/;
if ($1 eq "3") { print "You\'re using Netscape 3.0. Jolly good show.\n"; }
elsif ($1 eq "2") { print "You are using either Netscape 2.0 or MSIE 3.0.\n"; }
elsif ($1 eq "1") { print "Welcome to the 20th century.\n"; }
else { print "You aren\'t using Mozilla.\n"; }


-Dave