misterperl has asked for the wisdom of the Perl Monks concerning the following question:
$x='$cat->{dog}/mouse'; $y=localtime(); $_=$x; $z = "$_:$y";
my result is, unexpectedly,
$cat->{dog}/mouse:Mon Jul 31 13:54:17 2023
So $y was interpolated as expected, but $cat->{dog}/mouse was not? I also tried to force it to interpolate with eval. No joy. The value in $cat->{dog}/mouse was read from a mysql table, so I really dont have control over the types of quotes around it. I guess the issue is, interpolation is only at the top level - NOT recursive? So although $_ was interpolated as $x=$cat->{dog}/mouse, $cat->{dog} was not. How can I force interpolation to continue until there is nothing left to interpolate? Or, alternatively, how can I pre-process $x to force IT to interpolate? $x was read in from mysql and the value in it is not interpolated.
Cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is this string only PARTIALLY interpolated?
by stevieb (Canon) on Jul 31, 2023 at 18:54 UTC | |
| |
|
Re: Why is this string only PARTIALLY interpolated?
by tybalt89 (Monsignor) on Jul 31, 2023 at 19:40 UTC | |
|
Re: Why is this string only PARTIALLY interpolated?
by ikegami (Patriarch) on Aug 02, 2023 at 17:57 UTC | |
by misterperl (Friar) on Aug 04, 2023 at 12:52 UTC | |
by hippo (Archbishop) on Aug 04, 2023 at 15:47 UTC | |
by misterperl (Friar) on Aug 09, 2023 at 13:40 UTC | |
by ikegami (Patriarch) on Aug 05, 2023 at 06:05 UTC | |
by misterperl (Friar) on Aug 09, 2023 at 13:48 UTC | |
by cavac (Prior) on Aug 09, 2023 at 14:46 UTC | |
|
Re: Why is this string only PARTIALLY interpolated?
by tybalt89 (Monsignor) on Jul 31, 2023 at 19:48 UTC | |
|