I am trying to read a global symbol from another package. I have the package name as a string.
I am using qualify_to_ref
from Symbol
module
my $ref = qualify_to_ref ( 'myarray', 'Mypackage' ) ;
my @array = @$ref ;
gives me Not an ARRAY reference at ......
I presume I am getting the format of the dereference wrong.
Here is a complete example program.
use strict;
use Symbol ;
package Mypackage ;
our @myarray = qw/a b/ ;
package main ;
my $ref = qualify_to_ref ( 'myarray', 'Mypackage' ) ;
my @array = @$ref ;