#!/usr/bin/perl use strict; package obj; use vars qw($AUTOLOAD ); sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = { }; bless ($self, $class); return $self; } sub AUTOLOAD { my $self = shift; my $attr = $AUTOLOAD; $attr =~ s/.*:://; return if $attr eq 'DESTROY';··· $self->{uc $attr} = shift if @_; return $self->{uc $attr}; } package main; my $ob1 = obj->new; my $ob2 = obj->new; my $ob3 = obj->new; $ob1->data(100); $ob2->object($ob1); $ob3->name('data'); my $temp=$ob3->name; print $ob2->object->$temp;