in reply to Re^2: selcting all files in a given directory except......
in thread selcting all files in a given directory except......

try this script ...
#!/usr/bin/perl use strict; use warnings; my $dir = $ARGV[0] || $ENV{HOME}; my @files; if (-d $dir){ opendir (my $DIR, $dir); @files = grep {/^(?!\.{1,2}\z)/} readdir($DIR); closedir($DIR); } else { die("can't open the dir, $dir\n"); } foreach my $file (@files) { print "$file\n"; }
save the script as myls.pl, and run the script like this
$ perl myls.pl /home
ps. the $ENV{HOME} exist in the windows environment??

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.