Perl 6 allows passing scalars, arrays, hashes, or objects of any other type as the arguments to a sub. There are no restrictions regarding the combination and its order in a sub declaration. For example, the first argument may be an array, and the second one may be a scalar. Perl 6 will pass the … Continue reading “📘 Slurpy parameters and flattening in Perl 6”
In this issue, we’ll take a look at an interesting pattern of passing multiple arguments to a function and apply it to creating a recursive sum.
Pass a few scalars to a sub and work with them as with an array inside the sub. The task is to take a few scalar parameters and pass them to a single array in the subroutine. Here is an example of how to do that, prefixing an array name with a star: sub h($sep, … Continue reading “📘 Variadic parameters in a sub in Perl 6”
This book is about Perl 6, a programming language of the Perl family. It covers many basic and in-depth topics of the language and provides the initial knowledge you need to start working with Perl 6. The book does not require any previous experience with Perl, although some general understanding of programming is assumed. Electronic … Continue reading “Perl 6 at a Glance”