http://qs321.pair.com?node_id=397266

ant has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
,
I have wrote the code below in OO programming style, and am trying to get the box printed! But my referencing the hash is incorrect, and I've read several tutorials but still seem to fail to print the box.

Any help gratefully recieved.
Ant
in main.pl
use shapes; my %box; $box{line1} = ' ---'; $box{line2} = '| |'; $box{line3} = ' ---'; my $box = shapes->new(shape => %box); exit();
In shapes.pm
package shapes; #constructor sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; my $self = { shape => {}, }; return bless $self, $class; } sub print_shape { my $self = shift; print $self->{shape}{line1} . "\n"; } 1

Janitored by Arunbear - retitled from 'box trouble?!'