Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Apr 2000 23:26:49 -0700 (PDT)
From:      Ask Bjoern Hansen <ask@valueclick.com>
To:        Steve Price <sprice@hiwaay.net>
Cc:        freebsd-chat@freebsd.org
Subject:   Re: Un*x scripting magic
Message-ID:  <Pine.LNX.4.10.10004172324550.24795-100000@impatience.valueclick.com>
In-Reply-To: <Pine.OSF.4.21.0004171843020.30502-100000@fly.HiWAAY.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <<EndOfMessage;
> %%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 = <MF>; }
close MF;

is really cheap and easy.

But maybe I totally misunderstood what it was you wanted to do. :-)


 - ask

-- 
ask bjoern hansen - <http://www.netcetera.dk/~ask/>;
more than 70M impressions per day, <http://valueclick.com>;



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.10.10004172324550.24795-100000>