in reply to What's wrong with my code? [from a beginner]
They are correct, the my declaration is still in scope. My bad. </endupdate>
Simple fix, remove the 'my @entry;' line. entry then becomes global and the routine should work.
More complex fix: Pass the actual entry array. To do this, it needs to look like this.
This iterating over @_ allows you to pass more than one array reference to the subroutine, it will handle as many as you throw at it.&get_throughput(\@entry); sub get_throughput { my $entryref; foreach $entryref (@_) { ... if($entryref->[1] == "r") { $sim_time = $entryref->[3]; ...
There are other ways to tackle this as well...
-Scott
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What's wrong with my code? [from a beginner]
by holli (Abbot) on Jan 27, 2005 at 19:23 UTC | |
|
Re^2: What's wrong with my code? [from a beginner]
by Roy Johnson (Monsignor) on Jan 27, 2005 at 19:26 UTC | |
by Ardemus (Beadle) on Jan 28, 2005 at 00:23 UTC |