my $size; opendir DH, "test" or die "not opened"; while($_ = readdir(DH)) { $size = -s $_; print "error with size of following file: " unless $size; print $_; print "\n"; }