K
Kevin
#!/opt/perl_5.8.5/bin
# 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
evaluation
# by putting it in double quotes while printing, the string simply
does
# not get evaluated as no evaluation is specified during its
definition
# upon forcing evaluation by defining $sentence in double quotes, the
# compiler evaluates it as a system path, and does not interpolate the
variables.
# Is there a workaround which would enable evaluation of variables,
without
# 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";
print "$sentence";
# 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
evaluation
# by putting it in double quotes while printing, the string simply
does
# not get evaluated as no evaluation is specified during its
definition
# upon forcing evaluation by defining $sentence in double quotes, the
# compiler evaluates it as a system path, and does not interpolate the
variables.
# Is there a workaround which would enable evaluation of variables,
without
# 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";
print "$sentence";