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 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
>
> i want to take all the above files in to one array? how to do that?
>
>
> Thanks,
> Siva
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/