in reply to Trouble opening and reading file within loop

You've fallen for the basic readdir trap (you didn't RTFM close enough)

one easy solution (read glob for caveats) my @files = glob "Configs/*";

Path::Tiny is very convenient

use Path::Tiny qw/ path /; for my $file ( path( "Configs/" )->children ){ my @config = $file->slurp_raw; ... }

Replies are listed 'Best First'.
Re^2: Trouble opening and reading file within loop (readdir)
by Anonymous Monk on Sep 21, 2015 at 22:24 UTC
    :) s/slurp_raw/lines_raw/
Re^2: Trouble opening and reading file within loop (readdir)
by H0tc@xe (Initiate) on Sep 22, 2015 at 00:50 UTC
    I'm not understanding why readdir wont work in my case? The error is being thrown when the file in @files is being opened.

      I'm not understanding why readdir wont work in my case? The error is being thrown when the file in @files is being opened.

      Why not ? use my solutions?

      Have you read readdir?

      Its a very short read (only "79" words) and it explains exactly your case

      You're not alone in this, practically 99% of all questions about readdir are this same question

      Would you like to read readdir now, or simply start using something more convenient like glob, or better yet Path::Tiny?

        Yes I read readdir, I'm assuming "file testing the return values out of a readdir" is my case of why I can't use it? I used glob like you said. No more errors, but I get no output to STDOUT. I placed "print "$file\n" at the end of my first for loop and I see the files are being iterated through, but the guts of the script where I'm trying to find names and object-groups is not showing any output.