in reply to Errors on loops over data

What I would like is an easy way to know the line number in the file (or the array index I've slurped it into), and the actual incoming data that annoyed Perl, so I can fix it in the data file. Knowing the problem line in the code is only partially useful when it's a data problem.

Why don't you check?

if ( my $cat = $categories[$c] ){ $h{$val}=$cat; }