Mark,
There's no syntax error in that code UNLESS you're running under strictures, which it's obvious that you're not using the strict pragma.
EVERY Perl script you write should include the strict and warnings pragmas i.e.,
use strict;
use warnings;
All non global vars that are declared with...