use strict; package FOO; our($AUTOLOAD); sub new { my $class=shift; my $self; $self={}; # Sometimes you feel like a hash $self=[] # Sometimes you don't. if (int rand 2 == 0); bless $self,$class; } sub AUTOLOAD { my($self,$value)=@_; my($attr)=($AUTOLOAD=~m/::(.*?)$/); return if ($attr=~/^[A-Z]+$/); if ($attr=~/^[_\d]+$/) { print "Called digit accessor\n"; } else { print "Called non-digit accessor\n"; } } package main; my $t=new FOO; $t->_45; # "->45" won't make it through the parser $t->name;