Perl | glob() Function
glob() function in Perl is used to print the files present in a directory passed to it as an argument. This function can print all or the specific files whose extension has been passed to it.
Parameter: path of the directory of which files are to be printed.
Returns: the list of files present in the given directory
Example 1: Printing names of all the files in the directory
Above example will print all the files of the requested directory.
Example 2: Printing names of the specific files in the directory
Above example will print all the files of the requested directory that end with .txt extension.