#!/usr/bin/perl package Foo; sub new { bless {}, shift } sub DESTROY {1} sub AUTOLOAD : lvalue { my ( $method ) = $AUTOLOAD =~ /^.*::(.+)$/ or die "Invalid call to $AUTOLOAD"; *$AUTOLOAD = sub : lvalue { my $self = shift; if (@_) { $self->{$method} = shift; return $self; } $self->{$method}; }; goto &$AUTOLOAD; # Uncomment the following 'useless' line # and it works: # $Foo::baz; } package main; my $foo = Foo->new; $foo->bar = 4; print $foo->bar,"\n"; #### Can't modify goto in lvalue subroutine return at ...