use strict; use warnings; my $obj = bless {global1 => 0, global2 => 3}; $obj->setThree (6); $obj->doSomething (); print $obj->{four}; sub setThree { my ($self, $three) = @_; $self->{three} = $three; } sub doSomething { my ($self) = @_; $self->{four} = $self->{three} + $self->{global2}; } #### 9