if ( -d $path && !-l $path ) { ... } else { my $fileSize = -s $path; ... $sizeTotal += $fileSize; }