programming-examples/perl/File/List the files and subdirectories in a directory in alphabetical order.pl

10 lines
213 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/local/bin/perl
opendir(HOMEDIR, "/u/jqpublic") || die ("Unable to open directory");
@files = readdir(HOMEDIR);
closedir(HOMEDIR);
foreach $file (sort @files) {
print ("$file\n");
}