I'm a newbie, and feel this question isn't 'worthy' of your attention, but I'm curious as to why this behavior is as such. I do plan to check the perldocs tomorrow, but I'd like to know your thoughts as well. Here's the problem..
my $ua = $ENV{'HTTP_USER_AGENT'};
Using browser Netscape Navigator 6.2 the string returned is this:
Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2
The problem is if I use this code:
my $ua_name = $1 if ($ua=~ m/(opera|netscape|gecko|msie)/i);
I get this:
$ua_name: Gecko
Even though netscape is delcared before gecko in my regular expression, BUT if I use this:
my $ua_name = $1 if ( ($ua=~ m/(opera)/i) || ($ua=~ m/(netscape)/i) || ($ua=~ m/(gecko)/i) || ($ua=~ m/(msie)/i) );
I will get this:
$ua_name: Netscape
obviously in my first example it didn't matter what order I put the search patterns between the or operator, I thought it would matter. Can anyone confirm this, or did I already do that?
Alex2003-06-07 edit ybiC: retitle from "Simple Question for monks, but I'm curious..."
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |