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

Yes you should probably read more of that book :-)

Anway: an array only becomes false when it's empty. while (@array) will either not loop at all if the array is empty or loop forever until the array is empty.

while (<filehandle>) is a special case. all other construct with while(something) just test if something is true.

Replies are listed 'Best First'.
Re^6: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
by Fletch (Bishop) on Dec 31, 2007 at 23:27 UTC

    Well, it's only special in that it's silently twiddled into while( defined( $_ = <filehandle> ) ) { ... }; it otherwise is still looping until the value of the expression is false (the twiddling being done so that lines that would otherwise be interpreted a boolean false (e.g. 0\n) are differentiated from the diamond-operator-returns-undef-on-eof false value).</pedant>

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re^6: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASE
by Nik (Initiate) on Jan 01, 2008 at 21:50 UTC
    Yeah that why i used it in the 1st place while (<filehandle>) read a file line be line and only went false if there were no ther lines left so it escaped the llop

    while (@files) i believed would do the same thing as while (<filehandle>) did, except from insteading of reading a file line-by-line up ot the end i thought it would read an item-by-item over @array until the end of items and then go false.

      less believing, more rtfm