From owner-freebsd-chat Mon Apr 17 23:27: 0 2000 Delivered-To: freebsd-chat@freebsd.org Received: from impatience.valueclick.com (impatience.valueclick.com [216.246.25.100]) by hub.freebsd.org (Postfix) with SMTP id 5C1C137BC3A for ; Mon, 17 Apr 2000 23:26:53 -0700 (PDT) (envelope-from ask@valueclick.com) Received: (qmail 24816 invoked by uid 500); 18 Apr 2000 06:26:49 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Apr 2000 06:26:49 -0000 Date: Mon, 17 Apr 2000 23:26:49 -0700 (PDT) From: Ask Bjoern Hansen To: Steve Price Cc: freebsd-chat@freebsd.org Subject: Re: Un*x scripting magic In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, 17 Apr 2000, Steve Price wrote: > A have a chunk of perl code something like this. > > # insert bunch of code here > > my $msg < %%MESSAGE%% > EndOfMessage > > # more code goes here > > Then I have a multi-line (printable characters only) ASCII > text file containing the message that I'd like to replace > for %%MESSAGE%%. [1] Anyone have a neat little trick in > their bag-o-magic? I know the answer should be really > obvious but everything I've tried thus either hasn't worked > or was too convoluted. Why would you want to do that? Why not just read the file as you go? Something like: open MF, "messagefile" or die "Could not open messagefile: $!"; my $msg { local $/ = undef; $msg = ; } close MF; is really cheap and easy. But maybe I totally misunderstood what it was you wanted to do. :-) - ask -- ask bjoern hansen - more than 70M impressions per day, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message