perl中的“标量的实验值现在被禁止”问题

时间:2014-04-15 04:03:02

标签: perl

在Perl 5.26.1中,我得到:

Experimental each on scalar is now forbidden at a.plx line 67.
Type of arg 1 to each must be hash or array (not private variable) at a.plx   
line 67, near "$val)"
Execution of a.plx aborted due to compilation errors.

第67行是

中的while
 67         while (my ($ip, $val2) = each($val))
 68         {
                   ......
            }

3 个答案:

答案 0 :(得分:6)

检查here ...

<强>脚本:

var ul = document.createElement("ul");
document.body.appendChild(ul);

for (var i = 1; i <= 10; i++)
{
    var li = document.createElement("li");  
    li.className = "file";

    var a = document.createElement("a");
    a.innerHTML = "Subfile " + i;

    li.appendChild(a);
    ul.appendChild(li);
}

像这样你可以创建你想要的订单..

答案 1 :(得分:0)

请查看示例

<强> HTML

<li>
        <label for="Device"><SCRIPT LANGUAGE="JavaScript">  document.write("show javascript value like the the locations[i]")  </SCRIPT></label> <input type="checkbox" id="Device" /> 
        <ol>
            <li class="file"><a href="">File 1</a></li>
            <li>
                <label for="subfolder2">Subfolder 1</label> <input type="checkbox" id="subfolder2" /> 
                <div id='mi'></div>
            </li>
        </ol>

    </li>

<强> JS

var text = '<ol>';
    for (var i =0;i<6;i++)
    {

             text = text + "<li class='file'><a href=''>Subfile " + i + "</a></li>";

    }
 text = text +'</ol>';

document.getElementById('mi').innerHTML=text; 

在这里,我将<LI>放入js中的for循环中并将其存储到变量中,然后将其设置为div html。

答案 2 :(得分:0)

我刚才使用了一些jQueries效果回答了类似的问题 take a look at my example here

var list = $('#theList li:last-child'),
    limit = 20,
    current = 0;

function rand() {
    return Math.random().toString(36).substr(2); // Just for some random contnt
}

$('#trigger').click(function() { // We're using a static button to start the population of the list
        var end = setInterval(function() {
            if ( current == limit ) {
                current = 0;
                clearInterval(end);
            }
            list.append('<li style="display:none;color:green;">' + rand() + '</li>');
            var newList = $('#theList li:last-child');
            newList.fadeIn();
            var colorEnd = setInterval(function() {
                    newList.css('color', 'black');
                    clearInterval(colorEnd);
            }, 350);
            current =  current + 1;
        }, 300);
});