David Samuelsson wrote at Wed, 04 Sep 2002 09:44:01 +0200:
>> Since i got so much help from here i decided to send out this script so you can
>look at it. This script works for me, only on NT4+w2k though.
In addition to Felix good answer,
here's another hint:
>> if ($viewinfo =~ /snapshot/)
>> {
>> print HTML "<tr>\n\t<tr
>bgcolor\=\"\#FFFF99\">\n\t<td>$viewname</td>\n\t<td>Snapshot</td>\n\t<td>$vob</td>";
>> }
>> else
>> {
>> print HTML "<tr>\n\t<tr
>bgcolor\=\"\#FFFF99\">\n\t<td>$viewname</td>\n\t<td>Dynamic</td>\n\t<td>$vob</td>";
>> }
>> }
The only difference between the two lines is 'Snapshot' in the above
and 'Dynamic' in the other one.
You could also write it as:
my $viewkind = $viewinfo =~ /snapshot/ ? "Snapshot" : "Dynamic";
print HTML <<END_OF_HTML;
<tr>
<tr bgcolor\="#FFFF99">
<td>$viewname</td>
<td>$viewkind</td>
<td>$vob</td>
END_OF_HTML
[untested]
Allthough, that won't optimize speed,
it helps to avoid doubled code
what is good for readability and maintainance.
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]