Ovid has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone tell me why the following prints out both SCALAR and CODE? What am I missing?
#!/usr/bin/perl -l use strict; use warnings; { package Foo; sub bar {}; } foreach my $type ( qw<SCALAR ARRAY HASH CODE IO FORMAT> ) { print $type if defined *Foo::bar{$type}; }
I only want that to print CODE. How do I fix it?
Cheers,
Ovid
New address of my CGI Course.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Misbehaving typeglob
by Errto (Vicar) on Oct 27, 2006 at 16:35 UTC | |
|
Re: Misbehaving typeglob
by grep (Monsignor) on Oct 27, 2006 at 17:01 UTC | |
|
Re: Misbehaving typeglob
by stvn (Monsignor) on Oct 27, 2006 at 20:43 UTC | |
|
Re: Misbehaving typeglob
by diotalevi (Canon) on Oct 28, 2006 at 02:48 UTC |