Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: Printing accessor methods in here documents

by !1 (Hermit)
on May 06, 2005 at 21:37 UTC ( #454823=note: print w/replies, xml ) Need Help??


in reply to Re^3: Printing accessor methods in here documents
in thread Printing accessor methods in here documents

Uh, not exactly. It actually evaluates in list context but treats the return as if it were in scalar. Like so:

#!/usr/bin/perl -wl my @x = qw[ a b c d ]; sub x { print wantarray ? "list context" : defined(wantarray) ? "scalar context" : "void context"; @x } print "@{[ x() ]} - ${\ ( x() )} - ${\ ( @x )}"; __END__ list context list context a b c d - d - d

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2021-08-05 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (44 votes). Check out past polls.

    Notices?