print is claiming your parens. In other words, Perl sees your code as
print( ... )[2];
To fix the problem, use
print( (localtime(time))[2] );
or
print +(localtime(time))[2];
In reply to Re^3: array element return syntax
by ikegami
in thread array element return syntax
by Lyndley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |