請建議如何使用HTML模板獲取下拉列表中的數組值。如何在Perl CGI HTML模板的下拉列表中獲取數組值?
use HTML::Template;
open (FL, "<file.txt");
#(file.txt values are below)
#count1
#count2
#count3
#count4
#count5 ## samples
my @TOTAL = <FL>;
foreach $count(@TOTAL) {
chomp $count;
$template->param(COUNT => [{name => $count}]); # here I am getting only one value in the drop down menu (count1 value only)
}
我在等待下面的值,所以下拉列表中會列出所有的值。
$template->param(COUNT => [{name => $count1}, {name => $count2}, {name => $count3}, {name => $count4}]);
print $template->output, "\n";
請[編輯]你的問題,並注意正確的格式。這很難閱讀。 – simbabque
請解釋你正在使用的模塊並提供一些上下文,例如顯示'$ template'的來源。並不是所有人都閱讀過關於同一主題的[上一個](http://stackoverflow.com/q/34701433/176646)[問題](http://stackoverflow.com/q/34682634/176646)。 – ThisSuitIsBlackNot
嗨。我編輯了我的問題。謝謝 – bsd