my $dir = "/opt/DSPKG"; opendir(my $bin_dh, $dirs) or die "Can't open directory $dir: $!\n"; my @subdirs = grep { !/^\.\.?\z/ && -d "$dirs/$_" } readdir $bin_dh; my $pkg_file = '/tmp/pkgtest'; open(my $pkg_fh, '>', $pkg_file) or die "cant open pkgtest $pkg_file: $!\n"; foreach my $subdir (@subdirs) { print $pkg_fh "$subdir\n"; }
Other fixes:
In reply to Re: directory listing
by ikegami
in thread directory listing
by muizelaar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |