I want to tweak a small program I'm creating. It will read a directory and if it finds a file inside the directory with executable permissions it should do something.
Code:
#!/usr/bin/perl
my $dir_to_process = "/tmp";
opendir (DIR, $dir_to_process) || $dir or die "Cannot open $dir: $!";
while (my $name = readdir DIR) {
next if $name =~ /^\./;
if (-x $name)
{
print "Do something";
}
}
closedir DIR;
Comment