James Kipp wrote:
> 
> Hello

Hello,

> If I have an array of dir names and I want to capture the sub dir names and
> file
> names into an array, what is the best way to do this without overwriting the
> array each time thru? (see code below) Can I do a push or concatenate or
> something else ?

push(), unshift(), and splice() will all do what you want but you should
probably use push() in this instance.


> @dirs = qw( /dbm1/user/ /dbm2/user/ );
> 
> # read in the files and directory names in the directory excluding . and ..
> foreach $dir (@dirs)
> {
>         unless (opendir (DIR, $dir))
>         {
>                 print "\n Path not found - $dir\n\n";
>                 exit 1;
>         }
>         @filenames = grep (!/^\.\.?$/ , readdir (DIR));

          push @filenames, grep !/^\.\.?$/, readdir DIR;


> }
> closedir DIR;



John
-- 
use Perl;
program
fulfillment

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

Reply via email to