Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

perlfunc:scalar

by gods
on Aug 24, 1999 at 22:42 UTC ( #237=perlfunc: print w/replies, xml ) Need Help??

scalar

See the current Perl documentation for scalar.

Here is our local, out-dated (pre-5.6) version:


scalar - force a scalar context



scalar EXPR



Forces EXPR to be interpreted in scalar context and returns the value of EXPR.

    @counts = ( scalar @a, scalar @b, scalar @c );

There is no equivalent operator to force an expression to be interpolated in list context because it's in practice never needed. If you really wanted to do so, however, you could use the construction @{[ (some expression) ]}, but usually a simple (some expression) suffices.


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
shmem serves tea along with the cookies. (☕) x @CBMonks
[shmem]: hmm.. which makes emerge the question: is there a way to attach a subroutine to a variable, which is run as soon as that variable changes?
[moritz]: through a tie?
[shmem]: moritz: of course!
shmem slaps forehead m(

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-04-24 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (439 votes). Check out past polls.