J
J Krugman
If I try
my %x;
BEGIN {
%x = %{ do '/path/to/some/file' };
}
....where the file '/path/to/some/file' consists of the string
"+{ A => 1}\n", then everything is fine, but if instead I do
my %x;
BEGIN {
use constant DO_FILE => '/path/to/some/file';
%x = %{ do DO_FILE };
}
....I get an error ("Can't use an undefined value as a HASH reference").
(I get this error whether I place the "use constant" statement
inside or before the BEGIN block.)
Is there no way to perform a do operation in a BEGIN block using
a constant? Can someone explain to me, please, what's going on?
(Yes, I did read perlmod; it didn't help me with this one.)
Many thanks!
jill
my %x;
BEGIN {
%x = %{ do '/path/to/some/file' };
}
....where the file '/path/to/some/file' consists of the string
"+{ A => 1}\n", then everything is fine, but if instead I do
my %x;
BEGIN {
use constant DO_FILE => '/path/to/some/file';
%x = %{ do DO_FILE };
}
....I get an error ("Can't use an undefined value as a HASH reference").
(I get this error whether I place the "use constant" statement
inside or before the BEGIN block.)
Is there no way to perform a do operation in a BEGIN block using
a constant? Can someone explain to me, please, what's going on?
(Yes, I did read perlmod; it didn't help me with this one.)
Many thanks!
jill