[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] looping while putting things into an array and thenusing it...



Hello !

Robert A. Decker wrote:
> 
>     ...
> 
>    open (QUEUEDATAFILE, "<" . $queue_file_path);
>    @queuedatafile = (<QUEUEDATAFILE>);
                       ^^^^^^^^^^^^^^^
>        ... (code)
>
>       $line[$loop] = <QUEUEDATAFILE>;
                       ^^^^^^^^^^^^^^^
>        ... (code)

>    close QUEUEDATAFILE;

 Your problem may be that you try to read your file _twice_ without
 closing and opening it again. In the code above there is nothing to
 be assigned to '$line[$loop]'.

 So just use the array '@queuedatafile' from the first part of your
 code and go through this array in your search loop.

 Another hint: better use 'chop()' or 'chomp()' to strip off
 newlines - it's more effective.


 Hope this helps, Eike

=====================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
            email : eike.grote@theo.phy.uni-bayreuth.de
         URL : http://btrzxa.fddi.uni-bayreuth.de/~btpa25/
=====================================================================