Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: printing element of anonymous array

by Corion (Pope)
on Mar 03, 2018 at 15:37 UTC ( #1210280=note: print w/replies, xml ) Need Help??


in reply to printing element of anonymous array

This is because Perl sees something else, it associates the parentheses with print():

print(gmtime(time)) [6];

This makes no sense to Perl.

To fix this, you need one more set of parentheses:

print( (gmtime(time))[6] );

Replies are listed 'Best First'.
Re^2: printing element of anonymous array
by perltux (Monk) on Mar 03, 2018 at 15:39 UTC
    Many thanks for the quick explanation and solution!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1210280]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2020-01-23 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?