在HTML中发布打印Perl变量

时间:2013-12-03 23:58:59

标签: html perl internet-explorer cgi

我认为我认为这是一个相当容易解决的问题,但我无法弄明白。下面是我正在尝试构建的cgi网页的简单代码。它非常简单,但在我试图构建表格的底部,我去打印他们从未在IE中显示的变量。当我从命令行运行程序时,我看到td括号之间打印的值,但是IE没有显示它,它只是显示td括号中间的变量。关于我做错了什么的任何想法都会受到关注。

#!c:\Perl64\bin\perl.exe
use strict;
#use cgi;

my @Maskcnt;
my $word;
my @large; 
my @Licensecnt;


# Get Mask views currently running
my $external=qx(tasklist -v | grep -i maskview);
@Maskcnt=split(' ',$external);

@Licensecnt[0]="0";

#Compare Mask views against accounts and add for each instance
foreach $word (@Maskcnt)
{
    if ($word eq 'CAMELOTSRV\\LSI1')
    {
        @Licensecnt[1]=@Licensecnt[1]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI2')
    {
        @Licensecnt[2]=@Licensecnt[2]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI3')
    {
        @Licensecnt[3]=@Licensecnt[3]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI4')
    {
        @Licensecnt[4]=@Licensecnt[4]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI5')
    {
        @Licensecnt[5]=@Licensecnt[5]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI6')
    {
        @Licensecnt[6]=@Licensecnt[6]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI7')
    {
        @Licensecnt[7]=@Licensecnt[7]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSI8')
    {
        @Licensecnt[8]=@Licensecnt[8]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSIE1')
    {
        @Licensecnt[9]=@Licensecnt[9]+1;
    }elsif ($word eq 'CAMELOTSRV\\LSIE2')
    {
        @Licensecnt[10]=@Licensecnt[10]+1;
    }elsif ($word eq 'CAMELOTSRV\\Administrator')
    {
        @Licensecnt[11]=@Licensecnt[11]+1;
    }

}

#Begin HTML
print "Content-type: text/html\n\n";
print "<html><head><title>Camelot Licenses</title></head>\n";
# I put this one in the body to test to see if it was a table problem but this one doesn't show either.
print "<body><h1>@Licensecnt[1]\n</h1>";
print "<table border=\"1\">";
print "<tr>";
print "<th>Account</th>";
print "<th>License Count</th>";
print "</tr>";
print "<tr>";
print "<td>LSI1</td>";
print "<td>".@Licensecnt[1]."</td>"; # This gives me problems IE won't print it. Just Ignores the variable.
print "</tr>";
print "<tr>";
print "<td>LSI2</td>";
print "<td>".@Licensecnt[2]."</td>";
print "</tr>";
print "</table>";
print "</body></html>\n";

0 个答案:

没有答案