in reply to have synax error in this coding?

Ok, a quote from perlintro#if
if ( condition ) { ... } elsif ( other condition ) { ... } else { ... }
So the things you're missing are curly braces (not square brackets, or round parenthesis/parens)