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

Re: scalar context confusion

by peterdragon (Beadle)
on Feb 28, 2008 at 10:45 UTC ( [id://670880]=note: print w/replies, xml ) Need Help??


in reply to scalar context confusion

When you access an array in scalar context, it returns the number of elements. You can make this explicit so
my @list = qw/malay manab milan anand/; my $count1 = scalar @list; # these are my $count2 = @list; # the same
By surrounding it in quotes you are asking for the values to be interpolated into a string separated by $" (default space character). See http://perldoc.perl.org/perldata.html or type "perldoc perldata" for more information.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-24 11:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found