You could make an array of everything then grep out what you don't want.
#!/usr/bin/perl use strict; my(@t1)=dirarray("test1"); #get everything my(@t2)=grep !/^\./, dirarray("test2"); #get everything but dot files sub dirarray { my($dir)=@_; my $dh; opendir($dh, $dir) or die "$0: Cannot open $dir for listing: $!\n" +; my(@files)=readdir($dh) or die "$0: Can not list files in $dir: $! +\n"; return(@files); }
Then you can use the arrays as desired.
In reply to Re: reading directories
by dga
in thread reading directories
by data67
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |