Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my @dirs=''; my $dir='/usr/local/apache/cgi-bin/users'; my $choice=''; title(); #get user directories #get all the files in the directory opendir DIR, "$dir"; my @directory=grep(!/^\.\.?$/, readdir DIR); # remove . and .. entri +es closedir DIR; # get only directories not files foreach (@directory){ my path=$dir.'/'.$_; if (-d $path){ push @dirs,$_; } } # here i prove to myself that the array does contain values foreach (@dirs){ print "$_\n"; } #program flow while($choice ne 'x'){ if ($choice ne 'x'){ menu(); print "\nPlease enter an option =>"; $choice=chomp(<STDIN>); } if ($chioce eq '1'){ # parse user details file $no_users=0; foreach (@dirs){ my $path=$dir.'/'.$_; my $filename=$path.'/'.$_.'_details'; print "$_\n"; # this prints nothing!!!! # rest of scripr........etc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array contents vanishing...why is this???
by derby (Abbot) on May 30, 2002 at 13:16 UTC | |
|
Re: Array contents vanishing...why is this???
by cLive ;-) (Prior) on May 30, 2002 at 13:20 UTC | |
|
Re: Array contents vanishing...why is this???
by Kanji (Parson) on May 30, 2002 at 14:29 UTC | |
by Osiron (Initiate) on May 30, 2002 at 15:02 UTC |