On Saturday, August 10, 2002, at 08:02 , Ron Smith wrote:
> 5 if (@ARGV) {
> 6 foreach $ARGV (@ARGV) {
> 7 opendir (DIR, "$ARGV") or die "$!";
> 8 }
> 9 }
>
>
> So far, it looks like the last command-line argument is stepping on any
> other
> arguments that come before it. Is there a way to assign multiple
> command-line
> args to multiple directory handles?
yes, have you thought about using something like
IO::Handle
or dealing with each directory in turn and putting
the information into a hash?
our %dir_stuff;
if(@ARGV) {
foreach my $dir (@ARGV) {
if ( -d $dir ) {
opendir(DIR, "$dir") or die "unable to open directory
$dir:$!\n"
my @dirFoo= grep { $_ ne "." and $_ ne ".." }
readdir(DIR);
$dir_stuff{$dir}= \@dirFoo;
close(DIR) or die "unable to close directory $dir:$!\n"
}
}
}
this way you can rummage around in the file names listed
in each directory as passed in, to your hearts content...
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]