I dont know why but in my case also foreach ( readdir(...) )  didnt
work.....

try

while( $eachfile = readdir( KART ){
.....
}

This worked in my case.

-Rohit

Adriano Allora wrote:

> Hi to all,
> I need a script to open all the files in a directory and count all the
> words of them, but it doesn't work:
>
> use Text::ParseWords;
> $folder = "pathname";
> opendir(KART, $folder);
> foreach (readdir(KART)){
>         if(grep /\.txt$/, $_){
> $filename = "$_";
> open(INPUT, $filename);     ####this one does not work
> while (<INPUT>)
> {
> @words = split;
> $numero = @words;
> }
> print "in the file $filename there are $numero words \n";
> close(INPUT);
> }}
> closedir(KART);
>
> what's the tip I don't know?
> tnx a lot
>
> adr
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
POPI Classification:
[ ] MOTOROLA GENERAL BUSINESS INFORMATION
[ ] MOTOROLA INTERNAL USE ONLY
[ ] MOTOROLA CONFIDENTIAL PROPRIETARY


Reply via email to