Opendir example

Shows how to load and display the contents of an directory
# load all files of the "data/" folder # into the @files array opendir(DIR, "data/"); @files = readdir(DIR); closedir(DIR); # build a unsorted list from the # @files array: print "<ul>"; foreach $file (@files) { next if ($file eq "." or $file eq ".."); print "<li><a href=\"$file\">$file</a></li>"; } print "</ul>";

Url: http://www.jonasjohn.de/snippets/perl/opendir-example.htm

Language: Perl | User: ShareMySnippets | Created: Oct 16, 2013