in reply to Re^4: Perl List files in directory
in thread Perl List files in directory

The ... or die does not make sense when used in list context.

The cause you get your error is most likely because the readdir does not return any files. Maybe you meant

readdir DIR;

... instead of a bare readdir?

Replies are listed 'Best First'.
Re^6: Perl List files in directory
by Anonymous Monk on Apr 24, 2014 at 14:33 UTC

    problem solved:

    @files = grep (/\.xml$/, readdir(DIR));

    Thanks for the help