#!/usr/bin/perl -w $name = "c:\\"; opendir(DIR, $name) or die "Can't open $name due to $!"; @entries = readdir(DIR); closedir(DIR); # Sort results. @sorted = sort(@entries); foreach $entry (@sorted) { print "$entry\n"; }