Stupid Perl mistake


While messing around with Perl I ran into the following error:

$ perl -e 'use Time::Local print (localtime)[5] + 1900;'

syntax error at -e line 1, near ")["
Execution of -e aborted due to compilation errors.

I asked Perl guru Peter Marschall if he knew what was wrong with this statement, and Peter mentioned that ‘print’ is trying to use the ‘(’ and ‘)’ to enclose it’s argument list (which is not applicable here). Since I am still learning Perl, I don’t feel bad making mistakes (I am learning lots!)!

This article was posted by Matty on 2005-09-26 14:11:00 -0400 -0400