diff --git a/lib/File/DirWalk.pm b/lib/File/DirWalk.pm index 266abeb..b4be405 100644 --- a/lib/File/DirWalk.pm +++ b/lib/File/DirWalk.pm @@ -151,10 +151,8 @@ sub walk { } elsif (-d $path) { - if ($self->{depth} != 0) { - if ($self->{currentDepth} == $self->{depth}) { - return SUCCESS; - } + if (($self->{depth} > 0) and ($self->{currentDepth} == $self->{depth})) { + return SUCCESS; } opendir (my $dirh, $path) || return FAILED;