Hello,
I have yet another problem. I am in the process of writing a script. What this script does for the engineers here, is when they select a site (cgi) and click submit, the script gathers a table of information for that site, along with all of its neighbors. How i did this was, i used a preexisting script that i wrote, which actually parsed the data, and made it a subroutine. I then made an array, which had every "netid" for the neighbor sites. The subroutine, takes the "net-id" and selects the data, but it also has 2 more variables, which is where my problem arrises. See the other 2 variables are simply used to title the column produced by the subroutine.
So this is how i did it. I have 3 arrays, one with the netids (crucial for the data) one with the siteid(used for title) and one with the sector number (again, used for title). The for each loop is:
$i=0;
$index=@netids;
print "<TABLE>";
foreach $id(@netids){
print"<td>";
print "<pre>";
PRINT_INFO ($id,$nums[$i],$sects[$i]);
print "</pre>";
$i++;
}
I needed the $i in there, as a counter to ensure that the second two variables getting sent to the subroutine are the correct ones.
When i actually print out the lines that are sent to the subroutine using
print "PRINT_INFO ($id,$nums[$i],$sects[$i])";
i get this..
PRINT_INFO (2515,0040,1)
PRINT_INFO (9479,0040,2)
PRINT_INFO (2529,5228,1)
PRINT_INFO (9198,5228,2)
PRINT_INFO (9399,5458,1)
PRINT_INFO (12344,0473,3)
PRINT_INFO (14119,5335,1)
PRINT_INFO (14120,5335,2)
PRINT_INFO (14248,0267,3)
PRINT_INFO (19341,0314,1)
PRINT_INFO (19343,0314,3)
PRINT_INFO (19332,5268,1)
PRINT_INFO (19333,5268,2)
So i know the data being sent to the subroutine is complete and correct. This is how the sub routine parses the data
my ($netid, $sitename, $sector) = @_;
Now, from the actual data that the subrourine prints, the data itself is correct. However, the titles are not, it prints the same title a few times, or goes out of order, all kinds of wierd stuff, but the actual data, is correct.
Thanks In Advance
Dipul
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.