in reply to Re: Why is this string only PARTIALLY interpolated?
in thread Why is this string only PARTIALLY interpolated?

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: Why is this string only PARTIALLY interpolated?
by choroba (Cardinal) on Aug 01, 2023 at 15:06 UTC
    But what should happen if
    $x = '$x';
    ?

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Handles $x = '$x'; but ?

      #!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11153644 use warnings; my $cat = { dog => '$cat->{squirrel}', squirrel => 'fred' }; my $x='$cat->{dog}/mouse'; { my %loop; until( $loop{ my $new = eval qq("$x") }++ ) { $x = $new } } print "$x\n";
      Sadly, this horse has died.
Re^3: Why is this string only PARTIALLY interpolated?
by Corion (Patriarch) on Aug 01, 2023 at 15:03 UTC

    I'm not sure that this is well-advised, but a simple loop should be enough:

    $x = eval qq("$x") while $x =~ m!\$!;
      gotcha not terrible I guess! TY