Let's say y ou have a table you want to read in:
Bob 16 2500 Emily 19 4030 Fanny 12 300 John 20 5000
To read in this table into a 2-D array,@contact, here is the pseudo code:
while($line=<IN>)
{
parse $line using the split command
push @{$contact[current row]}, @temp;
#@temp is the output of the previous line
increment current row
}
$#contact gives the last index for rows (ie, # of rows -1)
$contact[0][0] gives the element at 0th row and 0th column = Bob
$#{$contact[0]} gives the (number of element -1) in the 0th row
for($i=0;$i<4;$i++)
{
for($j=0;$j<3;$j++)
{
print $contact[$i][$j];
}
}
will loop through the whole matrix and print the matrix as above.