Thank you
hdb. Yes, sure, but finding a workaround was not really my problem (I actually presented one in my original post), my problem was that I was convinced that it was possible to read lines directly from something like
<{$a[$c]}>, and it turns out that this was wrong.
As for the off-by-one error, you're correct, but it's a mistake I did when trying to simplify the code for the post, I did not have the error in my slightly more complicated original code. Yes, I am using strict and warnings for all my programs (except possibly very simple one-liners).