At 02:51 PM 8/6/01 -0400, Yacketta, Ronald wrote:
>Thanxs!
>
>now off to modify my exec code that parses an entire array of files :)

Of course, the arrayrefs could equally well have been stored in an array 
instead of a hash.  There's a thin justification for a hash in the absence 
of any other context, but the actual context could easily change that.

And your exec code ought not to have to change.  If you're used to doing 
something that says

         foo (@files)

then just do instead

         foo (@{$logFiles{$key})

where $key is one of the hash keys - obviously now you can loop through all 
of them.

> > This may seem a little obvious, but...
> >
> > my %logFiles;
> > for my $key (1 .. 6) {
> >    opendir DIR, "../logs/set$key" or die "opendir
> > ../logs/set$key: $!\n";
> >    push @{$logFiles{$key}}, map "../logs/set$key/$_",
> >                             grep !/^\.\.?$/, sort readdir DIR;
> >    closedir DIR;
> > }
> >
> > Now the filenames are in arrays which are referenced from the
> > values of the
> > hash %logFiles (keys are 1 through 6, but maybe you want to use the
> > directory name instead).  I took the liberty of removing the usually
> > useless directory entries and sorting, since you'll probably
> > want them
> > sorted later.

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to