in reply to Looping through an Array

It is because you're not using strict/warnings

Read this if you want to cut your development time in half!

$arrref and @arrref are two different variables, strict/warnings would have told you about it, Tutorials: Basic debugging checklist , brian's Guide to Solving Any Perl Problem