in reply to A serch and replace question

Why not this way?
#!perl use strict; use warnings; $^I=''; $/="\n||"; while (<>) { s/\n\|\|$/||/; print; print "-Damn" if eof; }

Replies are listed 'Best First'.
Re: Re: A search and replace question
by duff (Parson) on Oct 31, 2003 at 21:25 UTC
    I'll note that several of the replies have been using "\n" when the original problem description said the two pipes were preceded by a carriage return character and a line feed character. So, your code should set $/ = "\xd\xa||" rather than rely on the local newline convention as embodied by "\n".