Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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 !@monks...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-06-26 20:05 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (590 votes). Check out past polls.