Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Evaluate variable while using

by jo37 (Deacon)
on Oct 21, 2022 at 18:23 UTC ( [id://11147583] : note . print w/replies, xml ) Need Help??

in reply to Evaluate variable while using

Not a serious proposal, but another example of TIMTOWTDI:
You may create an array that holds an alias to $a as the second element and interpolate it into a string.

#!/usr/bin/perl use v5.16; use warnings; my $a = ''; local our @str; sub {*str = \@_}->('Hello', $a); $a = 'Kevin'; say "@str";