Skip to content

Instantly share code, notes, and snippets.

@yichao0319
Created September 27, 2013 21:50
Show Gist options
  • Save yichao0319/6735723 to your computer and use it in GitHub Desktop.
Save yichao0319/6735723 to your computer and use it in GitHub Desktop.
perl:open dir
opendir(DIR, $dir) or die $!;
while (my $file = readdir(DIR)) {
next if($file =~ /^\.+/); ## don't show "." and ".."
next if(-d "$dir/$file"); ## don't show directories
print "$file\n";
}
closedir(DIR);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment