in reply to Syntax error near Print

When I run the program, I keep getting "syntax error near 'print'".

Perl error messages generally report the line number in your script where the error occurred. (If you didn't see a line number in the error message, this would be evidence in favor of what others concluded -- maybe this isn't an error message from perl.)

Did you confirm that the line number in the error message matches the line number that you've shown us?

For future reference, when posting a question like this, it is best to paste in the exact text of the error message, and to show not only that particular line of your code, but also at least a few lines around it.

When variables or objects are used in the line causing the error, it also helps to say a little bit (or show additional code) to clarify what values (if any) have been assigned to the variables.