Browser Detection by PERL
I am enjoying PERL a lot. I am seeing everything new in PERL. I want to share interesting and important PERL stuffs through my blog.
Here is a PERL subroutine that detects whether the browser is Firefox or NOT.
sub is_firefox {
my $agent = ‘’;
$agent = $ENV{”HTTP_USER_AGENT”} || ‘’;
if (length($agent) && $agent =~ m/firefox/si) {
return 1;
}
return 0;
}
Enjoy PERL, the scripting pioneer.
$Rupom