Hi Stuart, @testarray gets the content of testmessage.txt, which contains the string '$name'. You cannot manipulate this string by setting the variable $name. You could do:
@testarray =~ s/\$name/$name/g; which will replace the literal string '$name' using your variable's content. I am just a beginner myself, and this is not meant to be a cool solution to anything, just a pointer. HTH, Jan [EMAIL PROTECTED] wrote: >Hi all: > >I'm trying to put a variable value into a text file. I've tried a few >things with no success. > >Anyone know how to do this ? Is it doable ? I'm pretty sure I read how >to do this somewhere, so I'm about to hit the Perl books to see if I can >find it. >Any help will be appreciated. > >Here's what I last tried. It doesn't work and I'm embarrassed to even >show it. But, I did want to show that at least I'm trying to make it >work: > >use strict; >use warnings; > >open (INFILE, "c:\\testmessage.txt") or die "The source file failed to >open - $!"; >my @testarray = <INFILE>; >my $name = "stuart"; >print @testarray; > >Here's what it prints: My name is $name. > >Here's the testmessage.txt file: My name is $name. > >After running my script, I'd like the testmessage.txt to read: My name is >stuart. > >Thanks again for any help. -- There's no place like ~/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>