#!/usr/bin/perl use warnings; use strict; package Box { sub new { my $classname = shift; my $self = {content => 1}; return bless($self, $classname); } sub addContent { my $self = shift; my $addition = shift; $self->{content} += $addition; } sub showContent { my $self = shift; print $self->{content}; print "\n"; } } my $box = Box->new(); $box->addContent(5); $box->showContent();