# Only ever produces 3 lines sub print_shape { my $self=shift; print $self->{shape}->{line1}."\n"; print $self->{shape}->{line2}."\n"; print $self->{shape}->{line3}."\n"; } #### # Allows for arbitary number of lines # (as long as they are sequentially numbered from 1) sub print_shape { my $self=shift; my $em=''; for (my $i=0; $i{shape}}); $i++) { $em = 'print $self->{shape}->{line' . ($i+1) . '}."\n"'; eval($em); } } #### my $box = [ '----', '| |', '----' ]; #### sub print_shape { my $self=shift; foreach (@{$self->{shape}}) { print "$_\n"; } }