perl -e '$self->{a$_};print keys %$self, $/;' -------- Can't call method "a" on an undefined value at -e line 1. #### 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