#!/usr/bin/perl package PKG; sub new { my $prototype = shift; # Allows for inheritence my $class = ref($prototype) || $prototype; my $self = {}; bless($self,$class); return $self; } #*AUTOLOAD=sub{$AUTOLOAD=~/:(.*?)$/&&$1ne'DESTROY'&&$_[1]?$_[0]{$1}=$_[1]:$_[0]{$1}}; #*AUTOLOAD=sub{$AUTOLOAD=~/:(.*?)(?foo('bar'); print $object->foo(), "\n"; $object->foo(undef); print $object->foo(), "\n";