in reply to Can you explain the difference with print?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can you explain the difference with print?
by hippo (Archbishop) on Aug 05, 2023 at 11:00 UTC | |
|
Re^2: Can you explain the difference with print?
by Bod (Parson) on Aug 05, 2023 at 23:27 UTC |