root/examples/slurpy-list-params/head-neck-tail.pl

Revision 11264, 489 bytes (checked in by Darren_Duncan, 3 years ago)

renamed about 44 more Perl 6 scripts from *.p6 to *.pl ... there are maybe 50-100 more that still need doing

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1sub head(*$head, *@tail)         { return $head }
2sub neck(*$head, *$neck, *@tail) { return $neck }
3sub tail(*$head, *@tail)         { return @tail }
4
5
6my @args = (1..5);
7
8    # $head parameter receives 1
9    # @tail parameter receives [2, 3, 4, 5]
10head(@args).say;
11
12
13    # $head parameter receives 1
14    # $neck parameter receives 2
15    # @tail parameter receives [3, 4, 5]
16neck(@args).say;
17
18    # $head parameter receives 1
19    # @tail parameter receives [2, 3, 4, 5]
20tail(@args).say;
21
Note: See TracBrowser for help on using the browser.