Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Explaining small Code

by Grimy (Pilgrim)
on Sep 21, 2013 at 18:26 UTC ( #1055144=note: print w/replies, xml ) Need Help??

in reply to Explaining small Code

You seem to be confused about vocabulary. \@numbers takes a reference to @numbers, which is the opposite of “dereferencing“.

It is needed because the natural representation for a matrix is an array of arrays. Since a perl array can only hold scalar values, arrays of arrays are actually arrays of references to arrays. PerlLoL goes into a lot more detail about this concept.

Without the backslash, all numbers would be squashed together inside @matrix without structure. The result would effectively be a list, not a matrix.

The question about split is easy to answer by looking at the doc. Without any argument, split splits $_ on whitespace. It is equivalent to split /\s+/, except that leading whitespace in $_ is ignored.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2016-10-28 15:42 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (386 votes). Check out past polls.