You were probably pretty close when you tried, but don't forget that when you eval a string, eval will take it literally, so you need to put double-quotes around it in order for it to be interpolated.
############################### use warnings; use strict; my $var = 'world'; undef $/; my $data = <DATA>; $data = eval "$data"; print $data; __DATA__ "hello $var" ############################### -----Original Message----- From: Andrew Brosnan [mailto:[EMAIL PROTECTED] Sent: Thursday, December 01, 2005 5:20 PM To: Timothy Johnson Cc: beginners@perl.org Subject: RE: Interpolating variables in a string from a file On 12/1/05 at 5:10 PM, [EMAIL PROTECTED] (Timothy Johnson) wrote: > perldoc -f eval Yes, I've read that. I can't seem to make it work though. Perhaps you could show me since you know how :-) > -----Original Message----- > From: Andrew Brosnan [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 01, 2005 5:06 PM > To: beginners@perl.org > Subject: Interpolating variables in a string from a file > > How can I make this do what I mean? > > > #!/usr/bin/perl > use warnings; > use strict; > > my $var = 'world'; > > undef $/; > my $data = <DATA>; > > print $data; #oops > > __DATA__ > hello $var > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>