in reply to Re: File editing
in thread File editing

You need to set $_ explicitely here.
perl -i -p -e '$_ = <> until $ok || m/RE/; $ok=1' foo

Replies are listed 'Best First'.
RE: RE: Re: File editing
by mirod (Canon) on Sep 29, 2000 at 00:56 UTC

    Darn! I never realized that the <> did not assign $_. Why o why?

    In any case thanks Fastolfe and dchetlin for pointing this out.

      Well it can assign $_. My mistake above and your originally is that <> only assigns $_ if it is the only thing inside the conditional of a while loop. I guess after using it that way for years I forgot it was the only way!

      I should have consulted the Camel before I posted my errors. The funny thing is what I posted does work sometimes (specifically it works with the two tests I used - there's a lesson there too), but also fails in unexpected (by me) ways.