I'm new to perl with previous experience using c++, c, Matlab, VBA, and some others I don't use often. I'm trying to write a program that simulates information coming from an AC measuring device but I can't seem to get the syntax for an array correct.

It says there's a syntax error at line 13. @CurrentWave[$inc] = $Wave;

After thinking about it, I realized I was trying to assign scalar values to a set variable. If I tell perl that @CurrentWave is a variable I don't have to do it again in the loop; I can treat it as a scalar, not a set/vector.

Note the use of the module to get the constant "pi". It is both clearer and more accurate than your litteral. I could have saved the multiply by two if I had imported pi2 instead, but I prefer it this way.

The assignment version of the "defined or" operator handles the arguments exactly the way you intend. For production code, it would be even better to use one of the Getopt modules.

The function 'map' builds the array. it handles all the iteration and storage details.

The special variable $LIST_SEPARATOR ($") allows us to print the entire array with one statement. The do and local are not really needed. They are used here to restrict the scope of $LIST_SEPARATOR to that print statement. Good Luck, Bill