Phoenix.pm: On another note
Beaves at aol.com
Beaves at aol.com
Thu Jan 27 12:17:15 CST 2000
In a message dated 1/26/00 7:17:20 PM US Mountain Standard Time,
mekla at geocities.com writes:
<< Also if something is declare non-my but never defined it still gets a
symbol
table entry. I thought someone had said the opposite but can't remember?
So if I did:
$TEMP;
It still gets a symbol table entry even though it is not defined.
>>
Yes in this case TEMP would appear in the symbol table, but only because of
initial parsing and compiling. (I believe for efficiency's sake) If you
deleted TEMP from the symbol table as a line of code, then saying $TEMP right
after does not create an entry..
For example:
print "TEMP exists\n\n" if exists $main::{TEMP}; # will print 'TEMP exists'
# even though you havn't gotten to that line yet.
$TEMP;
delete $main::{TEMP};
print "TEMP exists\n\n" if exists $main::{TEMP}; # will not print anything.
$TEMP;
print "TEMP exists\n\n" if exists $main::{TEMP}; # will not print anything.
$TEMP=undef;
print "TEMP exists\n\n" if exists $main::{TEMP}; # will print 'TEMP exists'
I discovered this by accident when my little symbol table sub did not work as
I was expecting.
Also, Shay, I didn't quite get the point of your code
If you do:
my $var = 9000;
$var never gets a symbol table entry. So if I had some weird thing like:
my $var = sub { return chr($_[0]) };
print &$var(65), "\n\n";
It seemed like you were missing a conclusionary sentence...
That sub reference above seems like it would work OK, am I missing something?
Tim
More information about the Phoenix-pm
mailing list