Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Scalar context of slice

by JavaFan (Canon)
on Oct 04, 2008 at 01:14 UTC ( #715302=note: print w/replies, xml ) Need Help??


in reply to Scalar context of slice

The canonical way of getting the number of elements of the list a function returns in list context is not by using 'map' (although that will work), but by assigning the result to an empty list, and assigning that to a scalar:
my $count = () = expression_in_list_context;
And if you remove some spaces, you're left with one of Perls secret operators:
my $count =()= expression; # Goatse operator.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2018-10-23 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (125 votes). Check out past polls.

    Notices?