Question - How to read a directory in Perl?
Answer -
The readdir function is used to read a directory in Perl. In scalar context, it will return each item one by one. In list context, it will return all the content of the directory in one statement. So list context uses more memory than scalar context.