Mega Code Archive

 
Categories / Perl / File
 

Use the functions opendir, readdir, and closedir

#!/usr/local/bin/perl -w     opendir (DIRHANDLE, ".");     @filelist = readdir (DIRHANDLE);     closedir (DIRHANDLE);     foreach $file (@filelist)     {        print "File: $file\n";     }