in reply to Syntax error with loops

Welcome to Perl. If you stick to this long enough you will find that "There is more than one way to do it" in Perl. Also, there has been a lot of work put in to make Perl simple like shell scripting yet powerful like C. For example, you can simplify your code above in many ways. Changing the Output Record Seperator, using join(). But since you are starting out, you can begin with the $_ variable.

The $_ or default variable is used by many functions in Perl, including the for or foreach functions. You see for will automatically assign the values within @HappyArray to the $_ variable one-at-a-time so you can access them within the for loop:

for (@HappyArray) { print "$_\n"; }

BTW, for and foreach are synonymous as far as Perl is concerned.

No counters, no iteration, just a simple loop which is much easier to understand.

Hope that helps. Keep learning.