SolaGracia has asked for the wisdom of the Perl Monks concerning the following question:
And I have a multi-dimensional array which contains handles to objects of type "Module_IO". Each File creates a new Object for every line of input from it.package Module_IO; use Moose; has name => (is => 'rw', isa => 'Str'); has net_type => (is => 'rw', isa => 'Str'); has width => (is => 'rw', isa => 'Str'); has direction => (is => 'rw', isa => 'Str'); sub print_all_IO{ my ($self) = @_; print $self->name; }
And once I have populated this array with sufficient number of handles, I want to print them out:$Module_IO_container[$FileNum][$index] = $obj;
However, as a result I get: one1 two1 three1 ... instead of: one two three What am I doing wrong?foreach my $a1 (@Module_IO_container) { foreach my $b1 (@$a1) { print $b1->print_all_IO, "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Package printing method issue
by chromatic (Archbishop) on Jun 24, 2013 at 18:06 UTC | |
|
Re: Package printing method issue
by SolaGracia (Initiate) on Jun 24, 2013 at 18:20 UTC |