For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > January 2005 > read a list of a directory









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author read a list of a directory
Simone P

2005-01-12, 8:56 pm

hi, is it possibile with perl read the list of all file inside a directory
(examples /test/*.txt) ???

Simone


Gunnar Hjalmarsson

2005-01-12, 8:56 pm

Simone P wrote:
> hi, is it possibile with perl read the list of all file inside a directory
> (examples /test/*.txt) ???


Yes.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
surfking

2005-01-12, 8:56 pm

While wandering through cyberspace on Wed, 12 Jan 2005 20:15:32 GMT
Simone P said :
> hi, is it possibile with perl read the list of all file inside a directory
> (examples /test/*.txt) ???
>
> Simone


Yes. There are several methods :

(1) use glob()

(2) use opendir() and readdir()
Tintin

2005-01-13, 8:57 am


"Simone P" <si.pa@tiscali.it> wrote in message
news:EzfFd.398483$b5.19369415@news3.tin.it...
> hi, is it possibile with perl read the list of all file inside a directory
> (examples /test/*.txt) ???


Yes, it is possible.

foreach my $file (</test/*.txt> ) {
..
}



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com