RE: about readdir call
[email protected] (Thomas Bätzler)
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
Rajnikant <[email protected]> asked: > I'm reading one directory using readdir call. but I'm getting > different output from that I got by running ls -l command on > same directory manually. Following is the snippet I'm using: > #!/usr/bin/perl -w $dirname = '/test_dir'; opendir ( DIR, $dirname ) || die "Error in opening dir $dirname\n"; foreach my $filename (sort grep { !/^\.\.?$/ } readdir(DIR)){ print("$filename\n") } closedir(DIR); __END__ HTH, Thomas