在 perl cgi 中使用两个数组或文件创建表需要帮助。
我需要创建一个表格,打印来自不同路径的目录列表,然后将其放入表格中,说第一列的标题是 path1,第二列是 path2,依此类推,每一列都列出了带有 href 链接的路径中的目录。这就是我所拥有的。
opendir(D, "../abc/status") or die"$!";
my @path1_dir = sort readdir D; closedir D;
opendir(D, "../def/status") or die "$!";
my @path2_dir = sort readdir D; closedir D; .... ...
print "\n"; print "$path1_dir\n"; print "$path2_dir\n";
#print list of directories to column-1 with title Path1
foreach my $path (@path1_dir) {
print "\t\n";
next if ($path =~ /^./);
next if ($path =~ /^\s*$/);
print "$path\n";
}
#this should go to the column two with Path2 title but it does not
foreach my $path (@path2_dir) {
print "\t\n"; `enter code here`
next if ($path =~ /^./);
next if ($path =~ /^\s*$/);
print "$path\n";
}
如果可以的话,有人可以帮我吗?