package Round; sub new { my $class = shift; my %args = @_; my $self = {}; $self->{_$_} = $args{$_} for qw( roundnum room judge type code contestants ); bless $self, $class; } sub roundnum { my $self = shift; $self->{_roundnum} = shift if @_; $self->{_roundnum}; } ------------- use Round; my $test = Round->new( roundnum => 1 ); my $testval = $test->roundnum; print "$testval\n";