#!/usr/bin/env perl use strict; use warnings; my $a = A->new({ hi => 'oi' }); print $a->hello."\n"; print $a->hi."\n"; package A; use base qw(Class::Accessor); A->mk_accessors(qw(hi)); sub hello { return "hello"; }