use feature 'refalias'; # "C:\>D:\#1183761.pl # Feature "refalias" is not supported by Perl 5.24.0 at D:\_Perl_\pl_test\#1183761.pl line 3. # BEGIN failed--compilation aborted at D:\_Perl_\pl_test\#1183761.pl line 3." # No mention of deprecation/elimination found in perldelta 5.24 but error as above. # Silence warnings if desired: no warnings 'experimental::refaliasing'; my ($x, $y); \$x = \$y; # alias here $x = 5; say $y; # prints nothing -- see msg above }; $seg++; say "\$seg = $seg"; #2 =head { my $x = 5; my $y = 273; make_alias( $x, $y ); # $seg = 2 # Undefined subroutine &main::make_alias called at D:\_Perl_\pl_test\#1183761.pl line 36. print $y; # prints nothing -- see msg above }; =cut $seg++; say "\$seg = $seg"; #3 { use Lexical::Alias; my $that = "not_that"; my $this = "another seg"; alias $that, $this; # $this is now an alias for $that. say $this; # prints "not_that" }; $seg++; say "\$seg = $seg"; #4 { my @x = qw(foo bar baz); my @y = qw(bat bif bim); alias @x, @y; for (@x) { say "element of \@x: " . $_; } for (@y) { say "\t element of \@y: " . $_; } }; $seg++; say "\$seg = $seg"; #5 =head { use Data::Alias; # from perldelta for 5.24: # Known Problems # Some modules have been broken by the context stack rework. # These modules were relying on non-guaranteed implementation # details in perl. my( $this, $that ); alias $that, $this; # $this is now an alias for $that. }; =cut =head FINAL OUTPUT AFTER commenting failed bareblocks: $seg: 1 $seg = 2 $seg = 3 not_that $seg = 4 element of @x: foo element of @x: bar element of @x: baz element of @y: foo element of @y: bar element of @y: baz $seg = 5 =cut