sub new { my ( $invocant, %shape ) = @_; # Stash all params into shape my $class = ref($invocant) || $invocant; my $self = { shape => \%shape, # Store a reference to the shape }; return bless $self, $class; } #### my $box = shapes->new(shape => %box); $box->print_shape(); # Do som real work #### sub new { my ( $invocant, @lines ) = @_; # Take the lines in orden # The line below is a bit cargo cultish, and I won't go into the reason here # Super search for clone / constructor for more info / enlightenment # my $class = ref($invocant) || $invocant; my $self = { shape => \@lines, }; return bless $self, $invocant; } sub print_shape { my $self = shift; my @lines = @{ $self->{ 'shape' } }; foreach my $line( @lines ) { print $lines, "\n"; } }