Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to force one variable to be an alias to another?

by vrk (Chaplain)
on Mar 09, 2017 at 11:05 UTC ( [id://1184019]=note: print w/replies, xml ) Need Help??


in reply to How to force one variable to be an alias to another?

Perl 5.22 introduced the refalias feature. The simplest solution to the example is

use v5.22; use warnings; use feature 'refalias'; # Silence warnings if desired: no warnings 'experimental::refaliasing'; my ($x, $y); \$x = \$y; # alias here $x = 5; say $y; # prints 5

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1184019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-06-16 12:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.