in reply to Re^4: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
in thread Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE

Compare the results of running
perl -e 'print "$_\n" for (1,2,3,4)'
to
perl -e 'print "$_\n" while (1,2,3,4)'
See what kind of results you get... The truth is that, no, 'while' does not iterate over the list/array, it loops while it is true (evaluated as a boolean). What you're looking for is the 'for' statement.

-Paul

Replies are listed 'Best First'.
Re^6: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
by Nik (Initiate) on Jan 01, 2008 at 21:43 UTC
    I got this error myabe because iam on windows
    C:\Documents and Settings\nik>perl -e 'print "$_\n" for (1,2,3,4)' Can't find string terminator "'" anywhere before EOF at -e line 1.
    even if i switch single quotes with double quotes iam still getting erros.

    I used the foreach statement finally.

    You say while loops over na @array while it is true.(evaluated as a boolean)? what do you mean?

    iterate!= loop ? I was picturing the statement while(@files) as loop over the array as long as it has items in it, and i though it was escaping after the last one.