in reply to question regarding slices
but it loops through the list twice, which may be a little inefficient, so you could use glob which removes the . and .. automatically.foreach(grep ! /^\.{1,2}$/, readdir(PRINT)){ #do work }
I prefer using glob().my $dir = '/path/to/dir'; foreach(glob('$dir/*')){ #do work }
my @array = readdir(PRINT); foreach(@array[2..$#array]){ #do work }
- Tom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:x2 question regarding slices (don't use regexps to filter . and ..)
by grinder (Bishop) on Nov 06, 2003 at 21:54 UTC |