Instead of counting the well-formed rows when trying to determine the existence of malformed rows, I'd count the malformed ones. In effect, you're using double negation ("no not well-formed rows"), which is less clear than the straightforward approach.
die '@mat malformed' if grep { @{$_} != @{$mat[0]} } @mat;
In reply to Re^2: How to extract the number of cols from a matrix?
by ikegami
in thread How to extract the number of cols from a matrix?
by parapara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |