dobby has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use diagnostics; my @dirvar=""; my $foreachvar=""; opendir(DIRHAN,"/xxx"); @dirvar = readdir(DIRHAN); print "@dirvar\n"; closedir(DIRHAN); foreach $foreachvar (</xxx/*>) { if (-f $foreachvar) {print "$foreachvar \n" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: foreach and opendir differences
by Tanktalus (Canon) on Apr 07, 2005 at 03:49 UTC | |
|
Re: foreach and opendir differences
by jpeg (Chaplain) on Apr 07, 2005 at 04:09 UTC | |
|
Re: foreach and opendir differences
by dobby (Initiate) on Apr 07, 2005 at 04:25 UTC | |
by willyyam (Priest) on Apr 07, 2005 at 10:52 UTC |