use strict; use warnings; my $obj = bless {hi => "Hello world"}; $obj->greet (); sub greet { my $self = shift; print "$self->{hi}\n"; }