Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- a problem with variable interpolation..
October 11, 2004, 4:13 am
rate this thread
# heres a peice of script which is troublin me since a while. Might as
well be # a newbee question!! The problem is,
# upon single quoting the $sentence ( see below) , and forcing
# by putting it in double quotes while printing, the string simply
# not get evaluated as no evaluation is specified during its
# upon forcing evaluation by defining $sentence in double quotes, the
# compiler evaluates it as a system path, and does not interpolate the
# Is there a workaround which would enable evaluation of variables,
# evaluating it as a path?
# and thus hopefully print '\dhdu\foo\sdjadf\bar\edjd\huh' ?
$var1 = 'foo';
$var2 = 'bar';
$var3 = 'huh';
$sentence = "\dhdu$var1\sdjadf$var2\edjd$var3";
Re: a problem with variable interpolation..
The '\' will escape anything that comes right after it. You probably want
to escape the '\' character itself, or use the '/' character instead
(which works just fine on multiple platforms).
"When you love someone, all your saved-up wishes start coming out."
- » FAQ: Can I use perl to run a telnet or ftp session?
- — Previous thread in » PERL Discussions