In PHP, I can write:
$vname = 'phone';
$$vname = '555-1234';
print $phone;
... And the script will output "555-1234".
Is there any equivalent in Perl?
Is there any way to constrain $phone
to the scope of the local block, as if I'd written my $phone
? Using my $$vname
gives me "Can't declare scalar dereference in my at ..." errors.