in reply to Re^2: Question on loops and variables
in thread Question on loops and variables

When I run the loop as ... it outputs data appropriately ...

I doubt it. Just to drive home the point of jethro's reply above, consider:

>perl -le "use warnings; ;; $empty_string = ''; @ra = split ',', $empty_string; ;; $foo = $ra[3]; $bar = $ra[5]; print qq{'$foo' '$bar'}; " Use of uninitialized value $foo in concatenation (.) or string at... Use of uninitialized value $bar in concatenation (.) or string at... '' ''

And once again, do yourself a favor and  use warnings; and  use strict;