From Perl 6 Now:

## Chapter 7 Listing 024 # Loop over the mod file datastructures, splicing each note encountere +d into # the wav data use PDL; use Perl6::Variables; my $offset = 0; # Output wav data offset my $offset_step = $sample_rate / 10; # 10 times a second notes may ch +ange for my $position (@positions) { for my $frame ( 0 .. 63 ) { for my $channel ( 0 .. 3 ) { my $note = @patterns[$position][$frame][$channel]; if($note->{sample}) { # the note for this channel changed my $scaled_sample = scale_sample($note, \@samples); my $scaled_sample_length = $scaled_sample->dim(0); $audio->range( [$channel, $offset], [0, $scaled_sample_length] ) .= $scaled_sample; } } $offset += $offset_step; } } ## Chapter 8 Listing 070 # @array_of_arrays will always contain exactly 5 array references afte +r this, # assuming @array_of_arrays and @array1 through @array5 have been decl +ared # Perl 5 my @array_of_arrays = (\@array1, \@array2, \@array3, \@array4); push @array_of_arrays, \@array5; # Perl 6 my @array_of_arrays = (@array1, @array2, @array3, @array4); push @array_of_arrays, @array5;

Update: One more example added.

the lowliest monk


In reply to Re^3: perl 6 list of lists example code sought by tlm
in thread perl 6 list of lists example code sought by eyepopslikeamosquito

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.