[Novalug] perl exiting loop question

Bonnie Dalzell bdalzell@qis.net
Sat Aug 6 00:47:16 EDT 2011


i have a loop in a program that, using a while loop,

reads data from a large file of unknown length in 256k bytes chunks and 
then within the loop does stuff to the data and saves it out to another 
open out file.

this works until I run out of input. then the program exits with an 
error:

"substr outside of string at libs/get_record.lib line 160"

when it exits the file the data is being written into is properly 
closed by the program exiting.

however what I would like to have the program do is to exit the while loop 
when the error appears without the program closing down.

i have tried stuff like this:
    while ($@ =~m/outside of string/){
      actions---
    }

but this exits the loop immediately

enlightenment and suggestions sought.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        Bonnie Dalzell, MA
mail:5100 Hydes Rd PO Box 60, Hydes,MD,USA 21082-0060|EMAIL:bdalzell@qis.net
Freelance anatomist, vertebrate paleontologist, writer, illustrator, dog
breeder, computer nerd & iconoclast... Borzoi info at www.borzois.com.
HOME www.batw.net    ART bdalzellart.batw.net  BUSINESS www.boardingatwedge.com




More information about the Novalug mailing list