Thanks Arturo for the tip! Why did I not think about it, I have no idea...
In any case, I finally made it work. Most of the times, the problem stairs right at you but you simply don't see it.
So, what I did whas this:
my @patterns = qw(-[45j][15j] [1-3][a46]u 41u 57h 7[9l]b 8[046]u 9[ab]
+t [1l][0b][uv] no [ou][j249][cdeg]);
my $pattern = join "|", @patterns; # Arturo's suggestion
my ($count) = 0;
my $rm = 0;
while (($CompName, $Department, $LogonDate, $NodeTel, $Model, $MTy
+pe, $SinNum, $Room, $Name, $Division, $freespace, $userID) = $sth->fe
+tchrow_array ()){
my $newpattern = $MType;
$mySkip = $count % 2;
$count = $count + 1;
print "<tr";
if ($newpattern =~ /^${pattern}$/oi) {
$rm++;
print " bgcolor=\"red\"";
$newpattern = shift;
} elsif ($mySkip eq 0) {
print " bgcolor=\"#CCFFCC\"";
} else {
print " bgcolor=\"white\"";
}
print ">\n";
}
The problem I had was two-fold (or maybe even not. I think I was eluded by another bug I discovered in the process).
In essence, everything is working now the way it's supposed to.
Thanks monks!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.