in reply to Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE

If you did a
die "error opening $ENV{'DOCUMENT_ROOT'}/data/text/$_: $!"
instead of an nondescript die $!, you would immediately see the problem I bet.

-Paul

Replies are listed 'Best First'.
Re^2: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
by Nik (Initiate) on Dec 31, 2007 at 20:55 UTC
    error opening D:/www/data/text/: No such file or directory at D:\www\cgi-bin\init.pl line 70.

    Thats what the the error said. Why $_ didnt get interpolated?
    Why? while (@files) supposed to contain all available .txt filenames from '/data/text'
    And i say while(@files) so to iterate one filename item after another in the loop so with the use of $_ i could open them and read the contents of it.
    Did i made a syntax error in the code? Isn't while (@files) a valid statement meaning iterate on every item of array @files?

      Isn't while (@files) a valid statement meaning iterate on every item of array @files?

      It is a valid statement, but it does not mean what you think it means. It iterates as long as @files is true, i.e., forever (since you do not modify @files). Again, I implore you to go read perlsyn (and/or a good perl book) and learn something.

        I was under the impression that 'while(@files)' iterates over each item of the array as long as @files is true, which means as long as it reaches up to the last item of tha array @files. ps. I have a book and read a few things last year but i guess that i need to read more...