in reply to readdir return nul string
Your code seems to works fine, readdir returns correct data (neither null?? or undef) and push all the files which ends with '.lip' in the @names array.
Oha
Ps: for other monks, i've put the OP code below
opendir( DIR, $directory ) or die "open dir error"; my $number = 0; while(defined($name = readdir (DIR))) { $number++; if($name eq "") { print "Value -$name* is null string." } print "Loop $number-->$name**\n"; next if $name eq "." || $name eq ".."; next unless $name =~ /(.*)\.lip$/; push @names, $name; }
|
|---|