Based on your logic, is it possible that you've hit a cell that has no data and therefore $parser is in fact undef - or falsy (e.g., 0, q{}, -1, etc)? This singular situation would force you to leave your loop via last;. And expecting anything in the array for that cell and beyond would come back as undefined.