in reply to Re: Syntax error
in thread Syntax error

One of the things we usually do when writing perl code, which makes it quicker and easier and less frustrating, is to create subroutines, rather than repeating lots of lines of code.

Apart from all the overly verbose comments and excessive printed messages to the user, you have about two times more lines of actual code than you really need, because a lot of it has been written twice. You should put the parts that are repeated into a subroutine, so that they only appear once, then call the subroutine from the places where you originally put each copy of identical code.

The basic idea is called "DRY": Don't Repeat Yourself.