dragonchild has asked for the wisdom of the Perl Monks concerning the following question:
perl -e '$self->{a$_};print keys %$self, $/;' -------- Can't call method "a" on an undefined value at -e line 1.
Going further, I get the following:
package Foo; sub new { my $c = shift; bless \$c, $c } sub bar { 'bar' } package main; $foo = Foo->new; $x{bar$foo} = 1; print "$_ => $x{$_}\n" for keys %x; -------- bar => 1
Further testing shows that $x{bar $foo} and $x{$foo->bar} also work.
Now, I knew that $x{bar()} works, because that's how you get constants in there. But, method calls?
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hashkey stringification ... sometimes.
by bart (Canon) on Mar 29, 2004 at 12:43 UTC | |
by dragonchild (Archbishop) on Mar 29, 2004 at 12:53 UTC | |
|
Re: Hashkey stringification ... sometimes.
by broquaint (Abbot) on Mar 29, 2004 at 12:42 UTC | |
|
Re: Hashkey stringification ... sometimes.
by QM (Parson) on Mar 29, 2004 at 14:15 UTC | |
by Anomynous Monk (Scribe) on Mar 30, 2004 at 02:13 UTC |