Dear monks
My question refers to assigning object into hash
I'm sending a hash reference to a Main function, inside the function I create objects and assign them into the hash
inside the function I can see all the objects inside the hash
Yet in the main part I can see only the last assigned object
BTW the same happen when I'm pushing the objects into array.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&parse_verilog($tool,\%params,\%rm_supply_nets,\%cells);
sub parse_verilog{
my ($tool,$params,$rm_supply_nets,$cells,$cells_hash ) = @_;
my $in_module = 0;
my $module;
my $new_cell;
open(V,$params->{'verilog_in'}) or die "$tool: Error: can't open s
+upplied verilog for reading\n";
my $line = "";
while(<V>){
chomp();
next if /^\s*\/\//;
s/\/\/[\S*||\s*]+$//; ## chop eol comments
$line .= $_;
if(/;\s*$/){ ## indicates end of line.
$_ = $line;
my @line_arr = split(/\s+/,$_);
$line = "";
s/\s*;\s*$//;
if(/^\s*module/i){
s/,/ /g;
$module = $line_arr[1];
$new_cell = new cell ($module);
$in_module = 1;
$new_cell->read_interface($_);
next;
}
}
if($in_module && /endmodule/i){
$cells->{$module} = $new_cell
$new_cell = 0;
$in_module = 0;
$line = "";
}
}
close(V);
};
Thanks in advance
Code tags added by GrandFather
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.