In message <199309301815.AA96858@dirac.scri.fsu.edu> you write:
> I ended up replacing the above code with:
>
> open(LS,"(cd $listdir; ls -1) |");
>
> while(<LS>) {
> $_ = &chop_nl($_); # strip any trailing newline
>
> followed by the while's body, finishing up with:
>
> close LS;
>
> I'm taking this opportunity to ask if this is a reasonable solution to
> the problem, and if the problem was really a problem. This is the
> first bit of Perl that I've ever written.
A better solution would be:
opendir(DIR, $listdir);
while (grep(!/^\.\.?$/, readdir(DIR))) { # The grep removes "." and ".."
<while body>
}
closedir(DIR);
Tim Irvin
|
|