in reply to Processing all files in a directory

readdir does not return a list of all files. Each time it is called it returns the next name. That means you want a while loop for that.

To get a list of file names, call glob. It satisfies the need to skip dotfiles, too

(Added) Oops, sauoq is correct - going back to see what is really failing. - Ah -     my $file = @_; in the subroutine. you probably mean     my ($file) = @_; The former puts @_ in scalar context, making $file equal the number of arguments given.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Processing all files in a directory
by sauoq (Abbot) on May 26, 2003 at 05:14 UTC
    readdir does not return a list of all files.

    It most certainly does, when called in list context.

    -sauoq
    "My two cents aren't worth a dime.";