in reply to file reading issues

First of all, I would re-write
$line = <FILENAME>; while ($line ne "") { print "$line"; $line = <FILENAME>; }
as
while (<FILENAME>) { print ; }
if the expected behavior is to print out every line of the file.

One way to tweak the above to get your desired output is as follows:

while (<FILENAME>) { last if /<!-- Begin -->/; } while (<FILENAME>) { last if /<!-- End -->/; print ; }

Replies are listed 'Best First'.
Re^2: file reading issues
by bofh_of_oz (Hermit) on Aug 03, 2005 at 19:35 UTC
    I would think that if there's text after <!-- BEGIN --> but on the same line, it would not be printed, as well as the text before <!-- End -->

    --------------------------------
    An idea is not responsible for the people who believe in it...

Re^2: file reading issues
by mojobozo (Monk) on Aug 03, 2005 at 19:10 UTC
    OK, this one worked! Thanks, jdporter!

    _____________________________________________________
    mojobozo
    word (wûrd)
    interj. Slang. Used to express approval or an affirmative response to
    something. Sometimes used with up. Source