SPUG: interpolating into a string variable

John W. Krahn krahnj at acm.org
Sun Dec 21 05:03:40 CST 2003

On Saturday 20 December 2003 21:50, Fred Morris wrote:
> Let's say we have a string variable. In practice it's read in from a
> file, but it could be a constant. And what we want to do is force
> interpolation into it before we use it for something like... ooooh, a
> regex. So, something like this:
>     my $foo_str = 'foo';
>     my $expr = 'a $foo_str happens here';
>     my $interpolated_expr = something magic happens to $expr;
> and then if you print "$interpolated_expr\n"; you would get
>     a foo happens here
> Is there a way to do this? For some reason, I thought there was...
> thought I'd ask, because it's a Saturday night and the answer isn't
> materializing for me... dang.


use Perl;

More information about the spug-list mailing list