in reply to qw() and lists of lists

my @nametape = ( [qw( 24 101 )], [qw( 25 102 )], [qw( 23 103 )], );

Note three things, though:


Improve your skills with Modern Perl: the free book.

Replies are listed 'Best First'.
Re^2: qw() and lists of lists (literals)
by Anonymous Monk on Mar 14, 2013 at 00:24 UTC

    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

      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

      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