Rich36 has asked for the wisdom of the Perl Monks concerning the following question:
The problem is this... When the application is run it outputs 'echo $user' instead of interpolating the value for $user. How would I get the value to be returned? I did implement a workaround by changing '$user' to 'user' in the config file, then running "=~ s/user/$user/g" in the code, and that worked. But I'm sure there's a better way...# The standard open file, read lines into an array (@lines), close fil +e is completed # Problem $user = $ENV{USER}; foreach $line(@lines) { print "$line\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Interpolating variables from a file
by tye (Sage) on Sep 19, 2001 at 00:28 UTC | |
|
(jeffa) Re: Interpolating variables from a file
by jeffa (Bishop) on Sep 19, 2001 at 00:21 UTC | |
|
Re: Interpolating variables from a file
by alien_life_form (Pilgrim) on Sep 19, 2001 at 01:14 UTC | |
|
Re: Interpolating variables from a file
by derby (Abbot) on Sep 19, 2001 at 00:50 UTC | |
by Rich36 (Chaplain) on Sep 19, 2001 at 01:28 UTC |