Re: How to make all files in one directory to an array

2008-03-20 Thread Chas. Owens
On Thu, Mar 20, 2008 at 9:16 AM, Süleyman Gülsüner <[EMAIL PROTECTED]> wrote: > Hi, > > You can use opendir, readdir and may play with grep as below; > > opendir $dir, '/tmp' or > @list = grep ! /^\.\.?$/, readdir($dir); > grep to remove '.' and '..' snip This isn't anymore efficient than

Re: How to make all files in one directory to an array

2008-03-20 Thread Süleyman Gülsüner
Hi, You can use opendir, readdir and may play with grep as below; opendir $dir, '/tmp' or @list = grep ! /^\.\.?$/, readdir($dir); grep to remove '.' and '..' @list = grep ! /^\.+/ # you can remove '.' , '..' and hidden files @list = grep /\.txt$/ # only txt files etc suleyman On

Re: How to make all files in one directory to an array

2008-03-20 Thread Ken Foskey
On Thu, 2008-03-20 at 18:20 +0530, sivasakthi wrote: > Hi all, > > How to form array by using the files available in particular directory ? > > for example, /tmp contains the following files.. > > #ls /tmp > example.txt > file1.txt > file2.txt > file3.txt > sample.txt > www.txt > zzz.txt > >

Re: How to make all files in one directory to an array

2008-03-20 Thread Chas. Owens
On Thu, Mar 20, 2008 at 8:50 AM, sivasakthi <[EMAIL PROTECTED]> wrote: > Hi all, > > How to form array by using the files available in particular directory ? snip my @list_of_files = ; However, this is not a good idea. Do you know how many files are in that directory? If it is an extraordinari