in reply to Declareing something with a *

what is *varAlias
A type glob.
Why when I made a little test of this could, I could get it to compile and run but no value was assigned to $reftype.
Do you have references in your package? It works for me:
#!/usr/bin/perl use warnings; $main::foo = []; while ((my $varname, my $globvalue) = each %main::){ local *varAlias = $globvalue; my $reftype = ref $varAlias; print "$varname = $reftype\n" if $reftype; } __END__ Name "main::foo" used only once: possible typo at /tmp/try line 5. foo = ARRAY
Note that looping over the entries in a stash will not find any lexical variables.
Would not compile with strict in use.
That's because you never introduced $varAlias. Either use:
our $varAlias = $globvalue;
or
use vars qw /*varAlias/;

Abigail

Replies are listed 'Best First'.
Re: Re: Declareing something with a *
by Scarborough (Hermit) on May 18, 2004 at 09:25 UTC
    Thanks just spoted myself that my first test didn't contain a referance. That makes sense now. As for the strict thing I think my predcessor, who used strict everwhere else didn't follow this particular procedure through to the end.
    Thanks for your help.