maddfisherman has asked for the wisdom of the Perl Monks concerning the following question:

is there a way to read a file not line by line because i want to loop through stuff w/o using variables but i have to find the right data in the file, and the data are separated by a boundry expression, but the boundaries for each peice of data are on different lines(togh). What im doing now is saving the file to an array by lines then turning the array into a string and then search the string for the boundries and save the stuff between and later print. I would like to find a way without saving the whole file into an array but because i need to find sruff on diff lines i cant loop through it.SORRY THIS IS REALLY HARD TO UNDERSTAND SO HERE IS A SUMMARY. I want to loop through data in a file but need to find data in multiple lines.EXAMPLE
file.txt 111****222222222222 22222222222****333333333333333 333333333333333**** so on and so on endfile.txt
what could i do to save the 1s 2s and 3s in an array without saving the whole file to an array line by line, then turning it into a string and then match and push the data onto an array?

Replies are listed 'Best First'.
Re: reading a file
by jryan (Vicar) on Aug 23, 2001 at 05:56 UTC

    Just set the input record seperator to your string. For instance:

    $/ = "****";