Here's a simple perl script where I am listing out the contents of a
directory. When it completes, the following error occurs. How do I
eliminate this?
Use of uninitialized value in length at C:\BegPerl\deldir.pl line 23.
Below is the script:
#!/usr/bin/perl
# Dsrch1.plx
# use strict ;
use warnings ;
$directory = $ARGV[0];
opendir(DIR, $directory) or die "Can't open $directory\n" ;
$direntry = readdir(DIR);
($mtime) = stat($direntry);
#######################################################
# read entire directory contents and print out #
#######################################################
while (length($direntry) > 0) {
print "$direntry - modify date: $mtime\n" ;
$direntry = readdir(DIR);
}
closedir(DIR);