Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Dereferencing and context?

by The Mad Hatter (Priest)
on Feb 08, 2004 at 18:18 UTC ( [id://327488]=note: print w/replies, xml ) Need Help??


in reply to Dereferencing and context?

I don't see why you would have expected the same output.

In the second example, $_ is an array ref and when you dereference it is an array (for all purposes here). Since you're concatenating to a string, it has to be a scalar value, and the scalar value of an array is the number of elements in that array. In the first example, you explicitly concatenate the elements of both arrays.

The difference is that in the first you are concatenating elements, and in the second you are concatenating the scalar values of two arrays.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found