Hi Experts,
I've created a package that looks like this:
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 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.
$Module_IO_container[$FileNum][$index] = $obj;
And once I have populated this array with sufficient number of handles, I want to print them out:
foreach my $a1 (@Module_IO_container) {
foreach my $b1 (@$a1) {
print $b1->print_all_IO, "\n";
}
}
However, as a result I get:
one1
two1
three1
...
instead of:
one
two
three
What am I doing wrong?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.