in reply to Re: Opening multiple log files
in thread Opening multiple log files

For the second one I've edited it. But for the for loops is the part where I'm trying to open each file in the directory. I'm guessing that's the wrong way, any ideas how I can fix this? So far I've only been able to open one file but the file name is hard coded. I want to be able to run the script for each file in the directory(each of the files have the same format).

Replies are listed 'Best First'.
Re^3: Opening multiple log files
by marinersk (Priest) on Jun 15, 2015 at 16:47 UTC

    I suspect you're being distracted by having too much information thrown at you at once.

    Examine just this bit of your code:

    my @list_files; for my $filename (@list_files) { }

    Do you see the problem? You just declared @list_files, so by definition it has nothing in it.

    Your loop therefore has nothing to do.

    Perhaps this will help you see the path forward:

    my @list_files = readdir $dir;