my @returnvalue; while(read directory) { skip some bad entries ('.' , '..', and non-dirs) add value to @returnvalue } return @returnvalue;