in reply to Evaluate variable while using

If your intention is to build up strings that contain variables, and then later interpolate that string with the values of the variables, one way would be like this:
my $a = ''; my $str = 'Hello $a'; $a = 'Kevin'; print eval qq{"$str"}

Replies are listed 'Best First'.
Re^2: Evaluate variable while using
by chickenman (Novice) on Oct 21, 2022 at 14:00 UTC
    Thank you, that's exactly what i was looking for.
      Thank you, that's exactly what i was looking for.

      Be aware that stringy eval has some serious security implications: if you give it anything based on user input, you'll have built yourself a giant security hole, as it will happily execute any arbitrary code. I strongly recommend you use one of the many other suggestions in this thread instead.