string not block Re: SPUG: interpolating into a string variable
Fred Morris
m3047 at inwa.net
Sun Dec 21 00:40:11 CST 2003
Ooerr.. that was my mistake, eval a string not a block... d'oh!
At 10:13 PM 12/20/03, Brian Hatch wrote:
> I wrote:
>> 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
>
>my $interpolated_expr;
>
>eval "\$interpolated_expr = \"$expr\"; ";
>
>(Hope I didn't miss any backslashes.)
Close enough to kick the proper brain cells into gear, thanks! ;-)
--
Fred Morris
fredm3047 at inwa.net (I-ACK)
More information about the spug-list
mailing list