in reply to File editing

I usually do this sort of thing in following manner:
open FH, "<fh.txt" or die "$!\n"; while (<FH>) { push(@y, $_), next if $flag; /^RE$/ and push(@y, $_), $flag++; } close FH;

This keeps things a bit more efficient, as it
minimalizes the amount of superflous tests --
why continue the extra overhead ( however minimal )
of checking for /^RE$/ after we already know
it's been met?

Replies are listed 'Best First'.
RE: RE: File editing
by Zarathustra (Beadle) on Sep 29, 2000 at 04:52 UTC
    Grumble.... I didn't realize I wasn't logged in, that anonymous post was mine... ah well.