SPUG: interpolating into a string variable
Yitzchak Scott-Thoennes
sthoenna at efn.org
Sun Dec 21 02:32:27 CST 2003
On Sat, Dec 20, 2003 at 09:50:43PM -0800, Fred Morris <m3047 at inwa.net> 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.
perldoc -q expand
More information about the spug-list
mailing list