Well we haven't been taught Perl yet, so I don't really know it. Plus this is a project based on UNIX shell scripting, so we have to do it that way. And trying without the square brackets didn't change the error. For example I used to have it as just "e"). It just doesn't like that ')' character for some reason.
Sorry about the lack of indenting in my code, I actually just pulled it from an example file and modified it to try to fit what I wanted to do. The file wasn't formatted so I had to enter line breaks and figure out where they began. So I wasn't totally sure on how the code was supposed to be structured.
Anyway I've been trying to make changes to my file in vi (that's all we get on this server), but it's giving me one of those "E514: write error (file system full?)" things when I try to save. I am using UNIX via SSH Secure Shell Client, and the shell I'm using is Bash. I emailed the instructor about this error already, I'm not sure if it's anything I can do.