#! /usr/local/bin/perl -w use strict; { package Nule; sub new { my $self = {}; shift; # Has package name $self->{A} = shift; $self->{B} = shift; $self->{C} = shift; bless ($self); return $self; } sub print_a { my $self = shift; print $self->{A}."\n"; } sub access_b { my $self = shift; if (@_) { $self->{B} = shift; } return $self->{B}; } sub print_stuff_c { my $self = shift; my $stuff = shift; print "$stuff".$self->{C}."\n"; } } # end of package # Main portion of program. # Create object my $thing = new Nule(1, 2, 3); # Print A $thing->print_a(); # Change B, then print it $thing->access_b(4); print $thing->access_b()."\n"; # Print C with some stuff $thing->print_stuff_c("Some stuff "); exit;