The question is, do you know how to print the matrix at all? I'm going to assume you can, and if so instead of:
# pseudocode
for row (0..rows) {
for col (0..cols) {
print array[row][col]
}
}
You substitute a list for the colums and rows you want to iterate over:
# pseudocode
for row (@goodrows) {
for col (@goodcols) {
print array[row][col]
}
}
As an aside, this is interesting...
@gm=map { [ @$_[@goodcols] ] } @matrix[@goodrows];
Giving a matrix with only the good columns and rows in it. Hmm. Although I'd have preferred some kind of
@matrix[@goodrows]->[@goodcols] syntax, but I'll have to wait for Perl 6 for that.