#!/usr/bin/perl -w
use strict;
my $aref = [1, 2, 3];
my @a = @$aref; # this line
$a[1] = 99;
print \"aref = @$aref\\n\";
print \"a = @a\\n\";
<
One option is to use the Data::Alias package from CPAN.
This way you can write:
#!/usr/bin/perl
use Data::Alias qw( alias );
my $aref = [1, 2, 3];
alias my @a = @$aref;
$a[1] = 99;
print "aref = @$aref\n";
print "a = @a\n";
A related question on SO can be found here: Assign address of one array to another in Perl possible?