小编mim*_*imo的帖子

perl错误:在连接(.)或字符串中使用未初始化的值$ _

我收到以下错误:

Use of uninitialized value $_ in concatenation (.) or string at checkfornewfiles.pl line 34.
Run Code Online (Sandbox Code Playgroud)

尝试运行以下代码时:

#!/usr/bin/perl -w
#Author: mimo
#Date 3/2015
#Purpose: monitor directory for new files...

AscertainStatus();
        ######### start of subroutine ########
sub AscertainStatus {
    my $DIR= "test2";

    ####### open handler #############
    opendir (HAN1, "$DIR") || die "Problem: $!";

    ########## assign theoutput of HAN1 to array1 ##########
    my @array1= readdir(HAN1);

    ######## adding some logic #########

    if ("$#array1" > 1) {   #### if files exists (more than 1) in …
Run Code Online (Sandbox Code Playgroud)

perl

-3
推荐指数
1
解决办法
5877
查看次数

标签 统计

perl ×1