use constant and BEGIN don't mix?
From: J Krugman (jkrugman_at_yahbitoo.com)
Date: 04/30/04
- Next message: Walter Roberson: "Re: How to tell Perl not to convert @mydomain.com part inside a body of message?"
- Previous message: John J. Trammell: "Re: First edition of _Programming perl_, how useful is it?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Apr 2004 18:55:03 +0000 (UTC)
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
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
- Next message: Walter Roberson: "Re: How to tell Perl not to convert @mydomain.com part inside a body of message?"
- Previous message: John J. Trammell: "Re: First edition of _Programming perl_, how useful is it?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|