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
In reply to Re: Processing all files in a directory
by Zaxo
in thread Processing all files in a directory
by billie_t
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |