Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: scoping problems

by AnomalousMonk (Monsignor)
on Jun 03, 2013 at 14:47 UTC ( #1036782=note: print w/ replies, xml ) Need Help??


in reply to Re^2: scoping problems
in thread scoping problems

Further to hdb's reply:

... it seems that a shorthand like [evaluating an array in scalar context] cant travel well around different loops etc.?

It travels perfectly well. hdb and others have already pointed out that  @saba and  $saba are quite different things and are in no way inherently related.

What may be confusing you is the fact that an element of the  @array array is accessed by the syntax  $array[n] (note the  $ sigil). The logic of this, determined by Larry at the Dawn of Time (Perl version 1.0), is that the elements of arrays (and also of hashes – associative arrays) are always and only scalars. But you always have to distinguish between an array, which contains (like a hash) a certain number of elements and thus has, among other properties, a size, and an element of an array.


Comment on Re^3: scoping problems
Select or Download Code
Re^4: scoping problems
by FloydATC (Hermit) on Jun 03, 2013 at 17:39 UTC
    The logic of this, determined by Larry at the Dawn of Time (Perl version 1.0), is that the elements of arrays (and also of hashes associative arrays) are always and only scalars.

    Interestingly, this logic (which sounds perfectly sane to me) has been abandoned in Perl 6. I don't understand why.

    -- FloydATC

    Time flies when you don't know what you're doing

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-08-02 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (54 votes), past polls