That's a classic mistake: when Perl sees print followed by an opening paren, it interprets that as print(...), i.e. like any regular function call foo(...), and then it doesn't understand the [6] following the function call. You need to disambiguate using one of several methods - the most explicit IMHO is an extra set of parentheses, print( (localtime)[6] );. Or better yet, just use one of the nicer OO interfaces like Time::Piece.
In reply to Re: Can you explain the difference with print?
by haukex
in thread Can you explain the difference with print?
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |