Perl Interview Questions and Answers
Question - 101 : - How to close a directory in Perl?
Answer - 101 : -
The closedir function is used to close a directory in Perl. This function officially shut down the connection between directory handle and directory.
Question - 102 : - How to change a directory in Perl?
Answer - 102 : -
The chdir function is used to change a directory in Perl. To change a directory and go inside a new directory you need required permission.
Question - 103 : - How to remove a directory in Perl?
Answer - 103 : -
The rmdir function is used to remove a directory in Perl. The directory which you want to remove should be empty before removing it.
Question - 104 : - How to read a directory in Perl?
Answer - 104 : -
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.
Question - 105 : - How to create a directory in Perl?
Answer - 105 : -
The mkdir function is used to create a directory in Perl. You need a require permission to create a directory.
Question - 106 : - How to open a directory in Perl?
Answer - 106 : -
The opendir function is used to open a directory in Perl. It returns true on success or false on failure.
Question - 107 : - What does file test operators do in Perl?
Answer - 107 : -
File test operators check miscellaneous information about a file, for example, the type of file, file byte size, its UID or GID, etc.