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

Re^2: qw() and lists of lists (literals)

by Anonymous Monk
on Mar 14, 2013 at 00:24 UTC ( #1023329=note: print w/ replies, xml ) Need Help??


in reply to Re: qw() and lists of lists
in thread qw() and lists of lists

there's no such thing as a list of lists. Lists never nest.

List literals never nest, a list of lists is an array of arrays


Comment on Re^2: qw() and lists of lists (literals)
Re^3: qw() and lists of lists (literals)
by chromatic (Archbishop) on Mar 14, 2013 at 06:01 UTC

    Can you make a non-literal list of lists which doesn't nest?

      Can you make a non-literal list of lists which doesn't nest?

      Sure, apples and oranges, peas and carrots, chrome and ticks

Re^3: qw() and lists of lists (literals)
by ikegami (Pope) on Mar 14, 2013 at 23:20 UTC

    List literals can be nested:

    (1,(2,3,(4,5)),6,7)

    List operators can be nested:

    >perl -MO=Concise -e"@a=(1,(2,3,(4,5)),6,7)" j <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 i <2> aassign[t3] vKS ->j - <1> ex-list lKP ->f 3 <0> pushmark s ->4 4 <$> const[IV 1] s ->5 c <@> list lKP ->d <-- This list... 5 <0> pushmark s ->6 6 <$> const[IV 2] s ->7 7 <$> const[IV 3] s ->8 b <@> list lKP ->c <-- ...has a list for operand 8 <0> pushmark s ->9 9 <$> const[IV 4] s ->a a <$> const[IV 5] s ->b d <$> const[IV 6] s ->e e <$> const[IV 7] s ->f - <1> ex-list lK ->i f <0> pushmark s ->g h <1> rv2av[t2] lKRM*/1 ->i g <#> gv[*a] s ->h -e syntax OK

    List values can't be nested:

    >perl -E"say for (1,(2,3,(4,5)),6,7)" 1 2 3 4 5 6 7

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-07-11 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (218 votes), past polls