"min() is a subroutine that I did not include. It does exactly what it sounds like, returns the minimum of two values in a list."
I did consider that might have been something like that (e.g. similar to List::Util's min() function); however, you're only providing a single value after min( in the code you posted.
Here's an example of how ${$vit_dist[$i-1]}[$j]+${$distance_mat[$i]}[$j] might be evaluated:
$ perl -Mstrict -Mwarnings -le '
my (@vit_dist, @distance_mat);
$vit_dist[0][0] = 30;
$distance_mat[1][0] = 12;
my ($i, $j) = (1, 0);
print ${$vit_dist[$i-1]}[$j]+${$distance_mat[$i]}[$j];
'
42
Perhaps you need a comma instead of a plus:
min(${$vit_dist[$i-1]}[$j], ${$distance_mat[$i]}[$j])
A liberalsplinklingofwhitespace may improve the readability of your code and reduce errors. :-)
|