read a list of a directory

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

Simone
Simone P [ Mi, 12 Januar 2005 21:15 ] [ ID #582524 ]

Re: read a list of a directory

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
Gunnar Hjalmarsson [ Mi, 12 Januar 2005 21:31 ] [ ID #582525 ]

Re: read a list of a directory

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()
surfking [ Do, 13 Januar 2005 00:38 ] [ ID #583092 ]

Re: read a list of a directory

"Simone P" <si.pa [at] tiscali.it> wrote in message
news:EzfFd.398483$b5.19369415 [at] 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>) {
..
}
Tintin [ Do, 13 Januar 2005 08:55 ] [ ID #583489 ]
Perl » alt.perl » read a list of a directory

Vorheriges Thema: Help
Nächstes Thema: $;