in reply to Read through directory and return matched data

First break the problem into sections, first, are you getting any files? Can you print @files.

Second, your path to files might need to be prepended with $dir, as you did in the readdir

#{ open FH, "$file"; { open FH, "$dir/$file"; # instead, possibly?

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Read through directory and return matched data
by JonDepp (Novice) on Nov 09, 2010 at 16:58 UTC

    I can print @files, and I can also print the contents of each file.

    I tried to put in the full path $dir/$file, but it gives me a readline on closed filehandle error.