The root port will be determined based on the algorithm below.
1. Lowest port cost
2. Lowest value of the forwarding switch's ID
3. Lowest port priority
4. Lowest internal port number
Friday, March 7, 2008
Saturday, March 1, 2008
Multidimensional array in perl
I have several arrays from results of reading and parsing each line from the input. Since Perl doesn't really have a multidimensional array, I need to find out the trick to handle this problem.
Found the page below after digging on google:
http://www.unix.org.ua/orelly/perl/prog3/ch09_01.htm
Then I test it with simple code, as below:
The result looks OK to me. Now it's the time to write the code into my project.
Found the page below after digging on google:
http://www.unix.org.ua/orelly/perl/prog3/ch09_01.htm
Then I test it with simple code, as below:
#!/usr/bin/perl
# to test reading a file, split it, then put it into array
use strict;
use warnings;
my $ref_line;
my @lines;
open FH,"testfile.txt";
while () {
push @lines, [split(" ",$_)];
}
for $ref_line (@lines) {
print "@$ref_line[7]\n";
}
The result looks OK to me. Now it's the time to write the code into my project.
Subscribe to:
Posts (Atom)