Herbert Breunung > Perl6-Doc-0.36 > Synopsis_29


Annotate this POD


Open  0
View/Report Bugs


Synopsis_29 - Builtin Functions

Version ^

 Author:        Rod Adams <rod@rodadams.net>
 Maintainer:    Larry Wall <larry@wall.org>
 Contributions: Aaron Sherman <ajs@ajs.com>
                Mark Stosberg <mark@summersault.com>
 Date:          12 Mar 2005
 Last Modified: 14 Jan 2008
 Version:       18

This document attempts to document the list of builtin functions in Perl 6. It assumes familiarity with Perl 5 and prior synopses.

The document is now the official S29. It's still here in the pugs repository temporarily to allow easy access to pugs implementors, but eventually it will be copied over to svn.perl.org. Despite its being "official", feel free to hack on it as long as it's in the pugs space. -law

This document is generated from the pod in the pugs repository under /docs/Perl6/Spec/Functions.pod so edit it there in the SVN repository if you would like to make changes.

Notes ^

In Perl 6, all builtin functions belong to a named package (generally a class or role). Not all functions are guaranteed to be imported into the global package ::*. In addition, the list of functions imported into ::* will be subject to change with each release of Perl. Authors wishing to "Future Proof" their code should either specifically import the functions they will be using, or always refer to the functions by their full name.

After 6.0.0 comes out, global aliases will not be removed lightly, and will never be removed at all without having gone through a deprecation cycle of at least a year. In any event, you can specify that you want the interface for a particular version of Perl, and that can be emulated by later versions of Perl to the extent that security updates allow.

Where code is given here, it is intended to define semantics, not to dictate implementation.

Operators vs. Functions

There is no particular difference between an operator and a function, but for the sake of documentation, only functions declared without specifying a grammatical category or with a category of term: (see "Bits and Pieces" in S02) will be described as "functions", and everything else as "operators" which are outside of the scope of this document.

Multis vs. Functions

In actual fact, most of the "functions" defined here are multi subs, or are multi methods that are also exported as multi subs. Multi subs are all visible in the global namespace (unless declared with a "my multi"). The assumption is that with sufficiently specific typing on the multis, the user is free to extend a particular name to new types.

Type Declarations ^

The following type declarations are assumed:


The root class of all "character" types, regardless of level.

This is a subtype of Str, limited to a length of 1 at it's highest supported Unicode level.

The type name Char is aliased to the maximum supported Unicode level in the current lexical scope (where "current" is taken to mean the eventual lexical scope for generic code (roles and macros), not the scope in which the generic code is defined). In other words, use Char when you don't care which level you're writing for.

Subclasses (things that are isa AnyChar):

CharLingua (language-defined characters)
Grapheme (language-independent graphemes)

Yes, Byte is both a string and a number.

The short name for Grapheme is typically Char since that's the default Unicode level. A grapheme is defined as a base codepoint plus any subsequent "combining" codepoints that apply to that base codepoint. Graphemes are always assigned a unique integer id which, in the case of a grapheme that has a precomposed codepoint, happens to be the same as that codepoint.

There is no short name for CharLingua because the type is meaningless outside the scope of a particular language declaration. In fact, CharLingua is itself an abstract type that cannot be instantiated. Instead you have names like CharFrench, CharJapanese, CharTurkish, etc. for instantiated CharLingua types. (Plus the corresponding StrLingua types, presumably.)

 subset Matcher of Item | Junction;

Used to supply a test to match against. Assume ~~ will be used against it.

 subset KeyExtractor of Code where { .sig === :(Any --> Any) };
 subset Comparator   of Code where { .sig === :(Any, Any --> Int ) };
 subset OrderingPair of Pair where { .left ~~ KeyExtractor && .right ~~ Comparator };

 subset Ordering where Signature | KeyExtractor | Comparator | OrderingPair;

Used to handle comparisons between things. Generally this ends up in functions like cmp(), eqv(), sort(), min(), max(), etc., as a $by parameter which provides the information on how two things compare relative to each other.

Note that eqv() and cmp() do almost but not the same thing since with eqv() you don't care if two things are ordered increasing or decreasing but only if they are the same or not. Rather than declare an Equiving type declaration Ordering will just do double duty.


A closure with arity of 2, which for ordering returns negative/zero/positive, signaling the first argument should be before/tied with/after the second. aka "The Perl 5 way".

For equivalence the closure returns either not 0 or 0 indicating if the first argument is equivalent or not to the second.


A closure with arity of 1, which returns the "key" by which to compare. Values are compared using cmp for orderings and eqv for equivalences, which in Perl 6 do different comparisons depending on the types. (To get a Perl 5 string ordering you must compare with leg instead.)

Internally the result of the KeyExtractor on a value should be cached.


A combination of the two methods above, for when one wishes to take advantage of the internal caching of keys that is expected to happen, but wishes to compare them with something other than eqv or cmp, such as <=> or leg.


If a signature is specified as a criterion, the signature is bound to each value and then each parameter does comparisons in positional order according to its type, as modified by its traits. Basically, the system will write the body of the key extraction and comparison subroutine for you based on the signature.

For ordering the list of positional parameter comparisons is reduced as if using [||] but all comparisons do not need to be performed if an early one determines an increasing or decreasing order. For equivalence the list is reduced as if using [&&].

Function Packages ^


The following are defined in the Any role:

 our Bool multi sub eqv (Ordering @by, $a, $b)
 our Bool multi sub eqv (Ordering $by = &infix:<eqv>, $a, $b)

Returns a Bool indicating if the parameters are equivalent, using criteria $by or @by for comparisons. @by differs from $by in that each criterion is applied, in order, until a non-zero (equivalent) result is achieved.

 our Order multi sub cmp (Ordering @by, $a, $b)
 our Order multi sub cmp (Ordering $by = &infix:<cmp>, $a, $b)

Returns Order::Increase, or Order::Same, or Order::Decrease (which numify to -1, 0, +1 respectively) indicating if paramater $a should be ordered before/tied with/after parameter $b, using criteria $by or @by for comparisons. @by differs from $by in that each criterion is applied, in order, until a non-zero (tie) result is achieved. If the values are not comparable, returns a proto Order object that is undefined.


The following are all defined in the Num role:

API document: Num

Num provides a number of constants in addition to the basic mathematical functions. To get these constants, you must request them:

 use Num :constants;

or use the full name, e.g. Num::pi.

 our Num multi method abs ( Num $x: ) is export

Absolute Value.

 our Int multi method floor ( Num $x: ) is export

Returns the highest integer not greater than $x.

 our Int multi method ceil ( Num $x: ) is export

Returns the lowest integer not less than $x.

 our Int multi method round ( Num $x: ) is export

Returns the nearest integer to $x. The algorithm is floor($x + 0.5). (Other rounding algorithms will be given extended names beginning with "round".)

 our Int multi method truncate ( Num $x: ) is export
 our Int multi method int ( Num $x: ) is export

Returns the closest integer to $x whose absolute value is not greater than the absolute value of $x. (In other words, just chuck any fractional part.) This is the default rounding function used by an int() cast, for historic reasons. But see Int constructor above for a rounded version.

 our Num multi method exp ( Num $exponent: Num :$base = Num::e ) is export

Performs similar to $base ** $exponent. $base defaults to the constant e.

 our Num multi method log ( Num $x: Num :$base = Num::e ) is export

Logarithm of base $base, default Natural. Calling with $x == 0 is an error.

 our Num multi method log10 (Num $x:) is export

A base 10 logarithm, othewise identical to log.

 our Num multi method rand ( Num $x: )
 our Num multi rand ( Num $x = 1 )

Pseudo random number in range 0 ..^ $x. That is, 0 is theoretically possible, while $x is not.

 our Int multi method sign ( Num $x: ) is export

Returns 1 when $x is greater than 0, -1 when it is less than 0, 0 when it is equal to 0, or undefined when the value passed is undefined.

 multi method srand ( Num $seed: )
 multi srand ( Num $seed = default_seed_algorithm())

Seed the generator rand uses. $seed defaults to some combination of various platform dependent characteristics to yield a non-deterministic seed. Note that you get one srand() for free when you start a Perl program, so you must call srand() yourself if you wish to specify a deterministic seed (or if you wish to be differently nondeterministic).

 our Num multi method sqrt ( Num $x: ) is export

Returns the square root of the parameter.

  (in Num) method roots (Num $x: Int $n --> List of Num) is export

Returns a list of all $nth (complex) roots of $x

    our Complex multi method cis (Num $angle:) is export

Returns 1.unpolar($angle)

    our Complex multi method unpolar (Num $mag: Num $angle) is export

Returns a complex number specified in polar coordinates. Angle is in radians.


    our Seq multi method polar (Complex: $nim) is export

Returns (magnitude, angle) corresponding to the complex number. The magnitude is non-negative, and the angle in the range -π ..^ π.

The :Trig tag

The following are also defined in Num but not exported without a :Trig tag. (Which installs their names into Num::Trig, as it happens.)

Standard Trig Functions
 Num multi method func ( Num  $x: $base = 'radians' ) is export(:Trig)

where func is one of: sin, cos, tan, asin, acos, atan, sec, cosec, cotan, asec, acosec, acotan, sinh, cosh, tanh, asinh, acosh, atanh, sech, cosech, cotanh, asech, acosech, acotanh.

Performs the various trigonometric functions.

Option $base is used to declare how you measure your angles. Given the value of an arc representing a single full revolution.

 $base      Result
 ----       -------
 /:i ^r/    Radians  (2*pi)
 /:i ^d/    Degrees  (360)
 /:i ^g/    Gradians (400)
 Num        Units of 1 revolution.

Note that module currying can be used within a lexical scope to specify a consistent base so you don't have to supply it with every call:

 my module Trig ::= Num::Trig.assuming(:base<degrees>);

This overrides the default of "radians".

 our Num multi method atan2 ( Num $y: Num $y = 1 )
 our Num multi atan2 ( Num $y, Num $x = 1 )

This second form of atan computes the arctangent of $y/$x, and takes the quadrant into account. Otherwise behaves as other trigonometric functions.


API document: Scalar

Scalar provides the basic tools for operating on undifferentiated scalar variables. All of the following are exported by default.

  our Bool multi defined ( Any $thing )
  our Bool multi defined ( Any $thing, ::role )

defined returns true if the parameter has a value and that value is not the undefined value (per undef), otherwise false is returned.

Same as Perl 5, only takes extra optional argument to ask if value is defined with respect to a particular role:

  defined($x, SomeRole);

A value may be defined according to one role and undefined according to another. Without the extra argument, defaults to the definition of defined supplied by the type of the object.

  our multi undefine( Any $thing )

Takes any variable as a parameter and attempts to "remove" its definition. For simple scalar variables this means assigning the undefined value to the variable. For objects, this is equivalent to invoking their undefine method. For arrays, hashes and other complex data, this might require emptying the structures associated with the object.

In all cases, calling undefine on a variable should place the object in the same state as if it was just declared.

  constant Scalar Scalar::undef

Returns the undefined scalar object. undef has no value at all, but for historical compatibility, it will numify to 0 and stringify to the empty string, potentially generating a warning in doing so. There are two ways to determine if a value equal to undef: the defined function (or method) can be called or the // (or orelse) operator can be used.

undef is also considered to be false in a boolean context. Such a conversion does not generate a warning.

Perl 5's unary undef function is renamed undefine to avoid confusion with the value undef (which is always 0-ary now).


 our Cat multi cat( *@@list )

cat reads arrays serially rather than in parallel as zip does. It returns all of the elements of the containers that were passed to it like so:


Typically, you could just write (@a,@b,@c), but sometimes it's nice to be explicit about that:

 @foo := [[1,2,3],[4,5,6]]; say cat([;] @foo); # 1,2,3,4,5,6

In addition, a Cat in item context emulates the Str interface lazily.

 our List multi roundrobin( *@@list )

roundrobin is very similar to zip. The difference is that roundrobin will not stop on lists that run out of elements but simply skip any undefined value:

 my @a = 1;
 my @b = 1..2;
 my @c = 1..3;
 for roundrobin( @a; @b; @c ) -> $x { ... }

will get the following values for $x: 1, 1, 1, 2, 2, 3

 our List of Capture multi zip ( *@@list )
 our List of Capture multi infix:<Z> ( *@@list )

zip takes any number of arrays and returns one tuple for every index. This is easier to read in an example:

 for zip(@a;@b;@c) -> $nth_a, $nth_b, $nth_c {

Mnemonic: the input arrays are "zipped" up like a zipper.

The zip function defaults to stopping as soon as any of its lists is exhausted. This behavior may be modified by conceptually extending any short list using *, which replicates the final element.

If all lists are potentially infinite, an evaluation in eager context will automatically fail as soon as it can be known that all sublists in the control of iterators of infinite extent, such as indefinite ranges or arbitrary replication. If it can be known at compile time, a compile-time error results.

Z is an infix equivalent for zip:

 for @a Z @b Z @c -> $a, $b, $c {...}

In @@ context a List of Array is returned instead of flat list.


All these methods are defined in the Array role/class.

 our List multi method delete (@array : *@indices ) is export

Sets elements specified by @indices in the invocant to a non-existent state, as if they never had a value. Deleted elements at the end of an Array shorten the length of the Array, unless doing so would violate an is shape() definition.

@indices is interpreted the same way as subscripting is in terms of slices and multidimensionality. See Synopsis 9 for details.

Returns the value(s) previously held in deleted locations.

An unary form is expected. See Hash::delete.

 our Bool multi method exists (@array : Int *@indices ) is export

True if the specified Array element has been assigned to. This is not the same as being defined.

Supplying a different number of indices than invocant has dimensions is an error.

An unary form is expected. See Hash::delete.

 our Scalar multi method pop ( @array: ) is export

Remove the last element of @array and return it.

 our Int multi method push ( @array: *@values ) is export

Add to the end of @array, all of the subsequent arguments.

 our Scalar multi method shift ( @array:  ) is export

Remove the first element from @array and return it.

 our List multi method splice( @array is rw: Int $offset = 0, Int $size?, *@values ) is export

splice fills many niches in array-management, but its fundamental behavior is to remove zero or more elements from an array and replace them with a new (and potentially empty) list. This operation can shorten or lengthen the target array.

$offset is the index of the array element to start with. It defaults to 0.

$size is the number of elements to remove from @array. It defaults to removing the rest of the array from $offset on.

The slurpy list of values (if any) is then inserted at $offset.

Calling splice with a traditional parameter list, you must define $offset and $size if you wish to pass a replacement list of values. To avoid having to pass these otherwise optional parameters, use the piping operator(s):

 splice(@array,10) <== 1..*;

which replaces @array[10] and all subsequent elements with an infinite series starting at 1.

This behaves similarly to Perl 5's splice.

If @array is multidimensional, splice operates only on the first dimension, and works with Array References.

splice returns the list of deleted elements in list context, and a reference to a list of deleted elements in scalar context.

 our Int multi method unshift ( @array: *@values ) is export

unshift adds the values onto the start of the @array.

 our List multi method keys ( @array: Matcher *@indextests ) is export
 our List multi method kv ( @array: Matcher *@indextests ) is export
 our List multi method pairs  (@array: Matcher *@indextests ) is export
 our List multi method values ( @array: Matcher *@indextests ) is export

Iterates the elements of @array, in order.

If @indextests are provided, only elements whose indices match $index ~~ any(@indextests) are iterated.

What is returned at each element of the iteration varies with function. values returns the value of the associated element; kv returns a 2 element list in (index, value) order, pairs a Pair(index, value).

@array is considered single dimensional. If it is in fact multi-dimensional, the values returned will be array references to the sub array.

In Scalar context, they all return the count of elements that would have been iterated.


The following are defined in the List role/class:

 our Cat multi cat ( @values )

Returns a Cat object, a concatenated version of the list that does the Str interface, but generates the string lazily to the extent permitted by the pattern of access to the string. Its two primary uses are matching against an array of strings and doing the equivalent of a join(''), except that join is always eager. However, a Cat in an interpolative context is also effectively eager, since the interpolator needs to know the string length. List context is lazy, though, so a cat of a cat is also lazy, and in fact, you just get a flat cat because cat in a list context is a no-op. The Cat interface also lets you interrogate the object at a particular string position without actually stringifying the element; the regex engine can make use of this to match a tree node, for instance, without serializing the entire subtree.

Accessing a filehandle as both a filehandle and as a Cat is undefined, because lazy objects are not required to be as lazy as possible, but may instead choose to precalculate values in semi-eager batches to maximize cache hits.

 our List of Pair multi method classify ( @values: Matcher $test )
 our List of Pair multi classify ( Matcher $test, *@values )

classify takes a list or array of values and returns a lazily evaluated list comprised of pairs whose values are arrays of values from the input list, and whose keys are the return value of the $test, when passed that value. For example:

  @list = (1, 2, 3, 4);
  (:@even, :@odd) := classify { $_ % 2 ?? 'odd' !! 'even' } @list;

In this example, @even will contain all even numbers from @list and @odd will contain all odd numbers from @list.

To simply transform a list into a hash of arrays:

  %cars_by_color = classify { .color } @cars;
 our List multi method grep ( @values: Matcher $test )
 our List multi grep ( Matcher $test, *@values )

grep takes a list or array of values and returns a lazily evaluated list comprised of all of the values from the original list for which the $test smart-matches as true.

Here is an example of its use:

 @friends = grep { .is_friend }, @coworkers;

This takes the array @coworkers, checks every element to see which ones return true for the .is_friend method, and returns the resulting list to store into @friends.

Note that, unlike in Perl 5, a comma is required after the Matcher in the multi form.

 our Item multi method first ( @values: Matcher $test )
 our Item multi first ( Matcher $test, *@values )

first works exactly like grep but returns only the first matching value.

 our List multi method pick ( @values: Int $num = 1, Bool :$repl )
 our List multi method pick ( @values: Whatever, Bool :$repl )
 our List multi pick ( Int $num, Bool :$repl, *@values )
 our List multi pick ( Whatever, Bool :$repl, *@values )

pick takes a list or array of values and returns a random selection of elements from the list (without replacement unless :repl is indicated). When selecting without replacement if * is specified as the number (or if the number of elements in the list is less than the specified number), all the available elements are returned in random order:

    @team = @volunteers.pick(5);
    @shuffled = @deck.pick(*);

When selecting with replacement the specified number of picks are provided. In this case * would provide an infinite list of random picks from @values:

    @byte = (0,1).pick(8, :repl);
    for (1..20).pick(*, :repl) -> $die_roll { ... }
 our Str multi method join ( $separator: @values )
 our Str multi join ( Str $separator = ' ', *@values )

join returns a single string comprised of all of the elements of @values, separated by $separator.

Given an empty list, join returns the empty string.

The separator defaults to a single space. To join with no separator, you can use the [~] reduce operator. The cat function also effectively does a concatenation with no separator.

 our List of Capture multi method map ( @values: Code *&expression )
 our List of Capture multi map ( Code $expression, *@values )

map returns a lazily evaluated list which is comprised of the return value of the expression, evaluated once for every one of the @values that are passed in.

Here is an example of its use:

 @addresses = map { %addresses_by_name<$_> }, @names;

Here we take an array of names, and look each name up in %addresses_by_name in order to build the corresponding list of addresses.

If the expression returns no values or multiple values, then the resulting list may not be the same length as the number of values that were passed. For example:

 @factors = map { prime_factors($_) }, @composites;

The actual return value is a multislice containing one slice per map iteration. In most contexts these slices are flattened into a single list.

 our Item multi method reduce ( @values: Code *&expression )
 our Item multi reduce ( Code $expression ;; *@values ) {
   my $res;
   for @values -> $cur {
     FIRST {$res = $cur; next;}
     $res = &$expression($res, $cur);
 role Hash {
     our Hash multi method reverse ( %hash: ) is export {
       (my %result){%hash.values} = %hash.keys;

 our List multi method reverse ( @values: ) is export
 our List multi reverse ( *@values ) {
    gather {
        1 while take pop @values;

 role Str {
     our Str multi method reverse ( $str: ) is export {
 our Array multi method sort( @values: *&by )
 our Array multi method sort( @values: Ordering @by )
 our Array multi method sort( @values: Ordering $by = &infix:<cmp> )

 our List multi sort( Ordering @by,  *@values )
 our List multi sort( Ordering $by = &infix:<cmp>, *@values )

Returns @values sorted, using criteria $by or @by for comparisons. @by differs from $by in that each criterion is applied, in order, until a non-zero (tie) result is achieved.

Ordering is as described in "Type Declarations". Any Ordering may receive either or both of the mixins descending and canon(Code $how) to reverse the order of sort, or to adjust the case, sign, or other order sensitivity of cmp. (Mixins are applied to values using but.) If a Signature is used as an Ordering then sort-specific traits such as is canon($how) are allowed on the positional elements.

If all criteria are exhausted when comparing two elements, sort should return them in the same relative order they had in @values.

To sort an array in place use the .=sort mutator form.

See http://www.nntp.perl.org/group/perl.perl6.language/16578 for more details and examples (with is insensitive meaning is canonicalized(&lc).)

 our Array multi method min( @values: *&by )
 our Array multi method min( @values: Ordering @by )
 our Array multi method min( @values: Ordering $by = &infix:<cmp> )

 our List multi min( Ordering @by,  *@values )
 our List multi min( Ordering $by = &infix:<cmp>, *@values )

Returns the earliest (i.e., lowest index) minimum element of @values , using criteria $by or @by for comparisons. @by differs from $by in that each criterion is applied, in order, until a non-zero (tie) result is achieved.

Ordering is as described in "Type Declarations". Any Ordering may receive the mixin canonicalized(Code $how) to adjust the case, sign, or other order sensitivity of cmp. (Mixins are applied to values using but.) If a Signature is used as an Ordering then sort-specific traits such as is canonicalized($how) are allowed on the positional elements.

 our Array multi method max( @values: *&by )
 our Array multi method max( @values: Ordering @by )
 our Array multi method max( @values: Ordering $by = &infix:<cmp> )

 our List multi max( Ordering @by,  *@values )
 our List multi max( Ordering $by = &infix:<cmp>, *@values )

Returns the earliest (i.e., lowest index) maximum element of @values , using criteria $by or @by for comparisons. @by differs from $by in that each criterion is applied, in order, until a non-zero (tie) result is achieved.

Ordering is as described in "Type Declarations". Any Ordering may receive the mixin canonicalized(Code $how) to adjust the case, sign, or other order sensitivity of cmp. (Mixins are applied to values using but.) If a Signature is used as an Ordering then sort-specific traits such as is canonicalized($how) are allowed on the positional elements.


The following are defined in the Hash role.

 our List  method :delete ( %hash: *@keys )
 our Scalar method :delete ( %hash: $key ) is default

Deletes the elements specified by $key or $keys from the invocant. returns the value(s) that were associated to those keys:

    @deleted = %foo.:delete{ @keys }
 our Bool method :exists ( %hash: $key )

True if invocant has an element whose key matches $key, false otherwise.

See also Code::exists to determine if a function has been declared. (Use defined() to determine whether the function body is defined. A body of ... counts as undefined.)

 multi Int|List keys ( %hash ; Matcher *@keytests )
 multi Int|List kv ( %hash ; Matcher *@keytests )
 multi Int|(List of Pair) pairs  (%hash ; Matcher *@keytests )
 multi Int|List values ( %hash ; Matcher *@keytests )

Iterates the elements of %hash in no apparent order, but the order will be the same between successive calls to these functions, as long as %hash doesn't change.

If @keytests are provided, only elements whose keys evaluate $key ~~ any(@keytests) as true are iterated.

What is returned at each element of the iteration varies with function. keys only returns the key; values the value; kv returns both as a 2 element list in (key, value) order, pairs a Pair(key, value).

Note that kv %hash returns the same as zip(keys %hash; values %hash)

In Scalar context, they all return the count of elements that would have been iterated.

The lvalue form of keys is not longer supported. Use the .buckets property instead.


General notes about strings:

A Str can exist at several Unicode levels at once. Which level you interact with typically depends on what your current lexical context has declared the "working Unicode level to be". Default is Grapheme. [Default can't be CharLingua because we don't go into "language" mode unless there's a specific language declaration saying either exactly what language we're going into or, in the absence of that, how to find the exact language somewhere in the enviroment.]

Attempting to use a string at a level higher it can support is handled without warning. The current highest supported level of the string is simply mapped Char for Char to the new higher level. However, attempting to stuff something of a higher level a lower-level string is an error (for example, attempting to store Kanji in a Byte string). An explicit conversion function must be used to tell it how you want it encoded.

Attempting to use a string at a level lower than what it supports is not allowed.

If a function takes a Str and returns a Str, the returned Str will support the same levels as the input, unless specified otherwise.

The following are all provided by the Str role:

 our Char multi method p5chop ( Str  $string is rw: ) is export(:P5)
 my Char multi p5chop ( Str *@strings is rw ) is export(:P5)

Trims the last character from $string, and returns it. Called with a list, it chops each item in turn, and returns the last character chopped.

 our Str multi method chop ( Str  $string: ) is export

Returns string with one Char removed from the end.

 our Int multi method p5chomp ( Str  $string is rw: ) is export(:P5)
 my Int multi p5chomp ( Str *@strings is rw ) is export(:P5)

Related to p5chop, only removes trailing chars that match /\n/. In either case, it returns the number of chars removed.

 our Str multi method chomp ( Str $string: ) is export

Returns string with one newline removed from the end. An arbitrary terminator can be removed if the input filehandle has marked the string for where the "newline" begins. (Presumably this is stored as a property of the string.) Otherwise a standard newline is removed.

Note: Most users should just let their I/O handles autochomp instead. (Autochomping is the default.)

 our Str multi method lc ( Str $string: ) is export

Returns the input string after converting each character to its lowercase form, if uppercase.

 our Str multi method lcfirst ( Str $string: ) is export

Like lc, but only affects the first character.

 our Str multi method uc ( Str $string: ) is export

Returns the input string after converting each character to its uppercase form, if lowercase. This is not a Unicode "titlecase" operation, but a full "uppercase".

 our Str multi method ucfirst ( Str $string: ) is export

Performs a Unicode "titlecase" operation on the first character of the string.

 our Str multi method normalize ( Str $string: Bool :$canonical = Bool::True, Bool :$recompose = Bool::False ) is export

Performs a Unicode "normalization" operation on the string. This involves decomposing the string into its most basic combining elements, and potentially re-composing it. Full detail on the process of decomposing and re-composing strings in a normalized form is covered in the Unicode specification Sections 3.7, Decomposition and 3.11, Canonical Ordering Behavior of the Unicode Standard, 4.0. Additional named parameters are reserved for future Unicode expansion.

For everyday use there are aliases that map to the Unicode Standard Annex #15: Unicode Normalization Forms document's names for the various modes of normalization:

 our Str multi method nfd ( Str $string: ) is export {
   $string.normalize(:cononical, :!recompose);
 our Str multi method nfc ( Str $string: ) is export {
   $string.normalize(:canonical, :recompose);
 our Str multi method nfkd ( Str $string: ) is export {
   $string.normalize(:!canonical, :!recompose);
 our Str multi method nfkc ( Str $string: ) is export {
   $string.normalize(:!canonical, :recompose);

Decomposing a string can be used to compare Unicode strings in a binary form, providing that they use the same encoding. Without decomposing first, two Unicode strings may contain the same text, but not the same byte-for-byte data, even in the same encoding. The decomposition of a string is performed according to tables in the Unicode standard, and should be compatible with decompositions performed by any system.

The :canonical flag controls the use of "compatibility decompositions". For example, in canonical mode, "fi" is left unaffected because it is not a composition. However, in compatibility mode, it will be replaced with "fi". Decomposed sequences will be ordered in a canonical way in either mode.

The :recompose flag controls the re-composition of decomposed forms. That is, a combining sequence will be re-composed into the canonical composite where possible.

These de-compositions and re-compositions are performed recursively, until there is no further work to be done.

Note that this function is really only applicable when dealing with codepoint strings. Grapheme strings are normally processed at a higher abstraction level that is independent of normalization, and are lazily normalized into the desired normalization when transferred to lexical scopes or handles that care.

 our Str multi method samecase ( Str $string: Str $pattern ) is export

Has the effect of making the case of the string match the case pattern in $pattern. (Used by s:ii/// internally, see S05.)

 our Str multi method samebase ( Str $string: Str $pattern ) is export

Has the effect of making the case of the string match the accent pattern in $pattern. (Used by s:bb/// internally, see S05.)

 our Str multi method capitalize ( Str $string: ) is export

Has the effect of first doing an lc on the entire string, then performing a s:g/(\w+)/{ucfirst $1}/ on it.


This word is banned in Perl 6. You must specify units.

 our Int multi method chars ( Str $string: ) is export

Returns the number of characters in the string in the current (lexically scoped) idea of what a normal character is, usually graphemes.

 our Int multi method codes ( Str $string: ) is export

Returns the number of graphemes in the string in a language-independent way.

 our Int multi method codes ( Str $string: $nf = $?NF) is export

Returns the number of codepoints in the string if it were canonicalized the specified way. Do not confuse codepoints with UTF-16 encoding. Characters above U+FFFF count as a single codepoint.

 our Int multi method bytes ( Str $string: $nf = $?NF, $enc = $?ENC) is export

Returns the number of bytes in the string if it were encoded in the specified way. Note the inequality:

    .bytes("C","UTF-16") * 2 >= .codes("C")

This is caused by the possibility of surrogate pairs, which are counted as one codepoint. However, this problem does not arise for UTF-32:

    .bytes("C","UTF-32") * 4 == .codes("C")
 our StrPos multi method index( Str $string: Str $substring, StrPos $pos = StrPos(0) ) is export

index searches for the first occurrence of $substring in $string, starting at $pos.

The value returned is always a StrPos object. If the substring is found, then the StrPos represents the position of the first character of the substring. If the substring is not found, a bare StrPos containing no position is returned. This prototype StrPos evaluates to false because it's really a kind of undef. Do not evaluate as a number, because instead of returning -1 it will return 0 and issue a warning.

 our Str multi pack( Str::Encoding $encoding,  Pair *@items )
 our Str multi pack( Str::Encoding $encoding,  Str $template, *@items )
 our buf8 multi pack( Pair *@items )
 our buf8 multi pack( Str $template, *@items )

pack takes a list of pairs and formats the values according to the specification of the keys. Alternately, it takes a string $template and formats the rest of its arguments according to the specifications in the template string. The result is a sequence of bytes.

An optional $encoding can be used to specify the character encoding to use in interpreting the result as a Str, otherwise the return value will simply be a buf containing the bytes generated by the template(s) and value(s). Note that no guarantee is made in terms of the final, internal representation of the string, only that the generated sequence of bytes will be interpreted as a string in the given encoding, and a string containing those graphemes will be returned. If the sequence of bytes represents an invalid string according to $encoding, an exception is generated.

Templates are strings of the form:

  grammar Str::PackTemplate {
   regex template  { [ <group> | <specifier> <count>? ]* }
   token group     { \( <template> \) }
   token specifier { <[aAZbBhHcCsSiIlLnNvVqQjJfdFDpPuUwxX\@]> \!? }
   token count     { \* |
             \[ [ \d+ | <specifier> ] \] |
             \d+ }

In the pairwise mode, each key must contain a single <group> or <specifier>, and the values must be either scalar arguments or arrays.

[ Note: Need more documentation and need to figure out what Perl 5 things no longer make sense. Does Perl 6 need any extra formatting features? -ajs ]

[I think pack formats should be human readable but compiled to an internal form for efficiency. I also think that compact classes should be able to express their serialization in pack form if asked for it with .packformat or some such. -law]


There is no pos function in Perl 6 because that would not allow a string to be shared among threads. Generally you want to use $/.to for that now, or keep your own position variable as a lexical.

 our Str multi method quotemeta ( Str $string: ) is export

Returns the input string with all non-"word" characters back-slashed. That is, all characters not matching "/[A-Za-z_0-9]/" will be preceded by a backslash in the returned string, regardless of any locale settings.

 our StrPos multi method rindex( Str $string: Str $substring, StrPos $pos? ) is export

Returns the position of the last $substring in $string. If $pos is specified, then the search starts at that location in $string, and works backwards. See index for more detail.

 our List multi method split ( Str $input: Str $delimiter, Int $limit = * ) is export
 our List multi method split ( Str $input: Rule $delimiter, Int $limit = * ) is export

String delimiters must not be treated as rules but as constants. The default is no longer ' ' since that would be interpreted as a constant. P5's split(' ') will translate to comb. Null trailing fields are no longer trimmed by default.

The split function no longer has a default delimiter nor a default invocant. In general you should use comb to split on whitespace now, or to break into individual characters. See below.

As with Perl 5's split, if there is a capture in the pattern it is returned in alternation with the split values. Unlike with Perl 5, multiple such captures are returned in a single Match object. Also unlike Perl 5, the string to be split is always the invocant or first argument. A warning should be issued if the string appears to be a short constant string and the delimiter does not.

You may also split lists and filehandles. $*ARGS.split(/\n[\h*\n]+/) splits on paragraphs, for instance. Lists and filehandles are automatically fed through cat in order to pretend to be string. The resulting Cat is lazy. Accessing a filehandle as both a filehandle and as a Cat is undefined.

 our List multi method comb ( Str $input: Rule $matcher = /\S+/, Int $limit = * ) is export

The comb function looks through a string for the interesting bits, ignoring the parts that don't match. In other words, it's a version of split where you specify what you want, not what you don't want. By default it pulls out all the words. Saying

    $string.comb(/pat/, $n)

is equivalent to


You may also comb lists and filehandles. +$*IN.comb counts the words on standard input, for instance. comb($thing, /./) returns a list of Char from anything that can give you a Str. Lists and filehandles are automatically fed through cat in order to pretend to be string. This Cat is also lazy.

If there are captures in the pattern, a list of Match objects (one per match) is returned instead of strings. The unmatched portions are never returned. If the function is combing a lazy structure, the return values may also be lazy. (Strings are not lazy, however.)

 our Str multi method sprintf ( Str $format: *@args ) is export

This function is mostly identical to the C library sprintf function.

The $format is scanned for % characters. Any % introduces a format token. Format tokens have the following grammar:

 grammar Str::SprintfFormat {
  regex format_token { '%': <index>? <precision>? <modifier>? <directive> }
  token index { \d+ '$' }
  token precision { <flags>? <vector>? <precision_count> }
  token flags { <[ \x20 + 0 \# \- ]>+ }
  token precision_count { [ <[1..9]>\d* | '*' ]? [ '.' [ \d* | '*' ] ]? }
  token vector { '*'? v }
  token modifier { < ll l h m V q L > }
  token directive { < % c s d u o x e f g X E G b p n i D U O F > }

Directives guide the use (if any) of the arguments. When a directive (other than %) are used, they indicate how the next argument passed is to be formatted into the string.

The directives are:

 %   a literal percent sign
 c   a character with the given codepoint
 s   a string
 d   a signed integer, in decimal
 u   an unsigned integer, in decimal
 o   an unsigned integer, in octal
 x   an unsigned integer, in hexadecimal
 e   a floating-point number, in scientific notation
 f   a floating-point number, in fixed decimal notation
 g   a floating-point number, in %e or %f notation
 X   like x, but using upper-case letters
 E   like e, but using an upper-case "E"
 G   like g, but with an upper-case "E" (if applicable)
 b   an unsigned integer, in binary
 C   special: invokes the arg as code, see below


 i   a synonym for %d
 D   a synonym for %ld
 U   a synonym for %lu
 O   a synonym for %lo
 F   a synonym for %f

Perl 5 compatibility:

 n   produces a runtime exception (see below)
 p   produces a runtime exception

The special format directive, %C invokes the target argument as code, passing it the result string that has been generated thus far and the argument array.

Here's an example of its use:

 sprintf "%d%C is %d digits long",
    sub($s,@args is rw) {@args[2]=$s.elems},

The special directive, %n does not work in Perl 6 because of the difference in parameter passing conventions, but the example above simulates its effect using %C.

Modifiers change the meaning of format directives. The most important being support for complex numbers (a basic type in Perl). Here are all of the modifiers and what they modify:

 h interpret integer as native "short" (typically int16)
 l interpret integer as native "long" (typically int32 or int64)
 ll interpret integer as native "long long" (typically int64)
 L interpret integer as native "long long" (typically uint64)
 q interpret integer as native "quads" (typically int64 or larger)
 m interpret value as a complex number

The m modifier works with d,u,o,x,F,E,G,X,E and G format directives, and the directive applies to both the real and imaginary parts of the complex number.


 sprintf "%ld a big number, %lld a bigger number, %mf complexity\n",
        4294967295, 4294967296, 1+2i);
 our Str multi method substr (Str $string: StrPos $start, StrLen $length?) is rw is export
 our Str multi method substr (Str $string: StrPos $start, StrPos $end?) is rw is export
 our Str multi method substr (Str $string: StrPos $start, Int $length) is rw is export

substr returns part of an existing string. You control what part by passing a starting position and optionally either an end position or length. If you pass a number as either the position or length, then it will be used as the start or length with the assumtion that you mean "chars" in the current Unicode abstraction level, which defaults to graphemes. A number in the 3rd argument is interpreted as a length rather than a position (just as in Perl 5).

Here is an example of its use:

 $initials = substr($first_name,0,1) ~ substr($last_name,0,1);

Optionally, you can use substr on the left hand side of an assignment like so:

 $string ~~ /(barney)/;
 substr($string, $0.from, $0.to) = "fred";

If the replacement string is longer or shorter than the matched sub-string, then the original string will be dynamically resized.


Should replace vec with declared buffer/array of bit, uint2, uint4, etc.



See "The context and caller functions" in S06.

 multi eval ( Str $code, Grammar :$lang = CALLER::<$?PARSER>)

Execute $code as if it were code written in $lang. The default is the language in effect at the exact location of the eval call.

Returns whatever $code returns, or fails.

 multi evalfile (Str $filename ; Grammar :$lang = Perl6)

Behaves like, and replaces Perl 5 do EXPR, with optional $lang support.

 multi exit (Int $status = 0)

Stops all program execution, and returns $status to the calling environment.

 multi nothing ()

No operation. Literally does nothing.

 our Num multi sleep ( Num $for = Inf )

Attempt to sleep for up to $for seconds. Implementations are obligated to support sub-second resolutions if that is at all possible.

See Synopsis 17: Concurrency for more details.


See "The want function" in S06.


TODO: Research the exception handling system.


 our Object multi method bless( Object::RepCandidate $candidate )
 our Object multi method bless( *%args )

bless is only available as a method which can be called on a prototype object like so:

 $object = $proto.bless(k1 => $v1, k2 => $v2, ...);

A newly created object, based on either the $candidate representation or a newly created representation (initialized with the %args that are passed in) when the second form is used.

It automatically calls all appropriate BUILD routines by calling the BUILDALL routine for the current class, which initializes the object in least-derived to most-derived order. See "Objects" in S12 for more detailed information on object creation.

 multi Char method chr( Int $grid: ) is export
 multi Char sub chr( Int *@grid )
 multi Int method ord( Str $string: ) is export

chr takes zero or more integer grapheme ids and returns the corresponding characters as a string. If any grapheme id is used that represents a higher abstraction level than the current lexical scope supports, that grapheme is converted to the corresponding lower-level string of codepoints/bytes that would be appropriate to the current context, just as any other Str would be downgraded in context.

ord goes the other direction; it takes a string value and returns character values as integers. In a scalar context, the return value is the just the integer value of the first character in the string. In a list context, the return value is the list of integers representing the entire string. The definition of character is context dependent. Normally it's a grapheme id, but under codepoints or bytes scopes, the string is coerced to the appropriate low-level view and interpreted as codepoints or bytes. Hence, under "use bytes" you will never see a value larger than 256, and under "use codepoints" you will never see a value larger than 0x10ffff. The only guarantee under "use graphemes" (the default) is that the number returned will correspond to the codepoint of the precomposed codepoint representing the grapheme, if there is such a codepoint. Otherwise, the implementation is free to return any unique id that larger than 0x10ffff. (The chr function will know how to backtranslate such ids properly to codepoints or bytes in any context. Note that we are assuming that every codepoints context knows its normalization preferences, and every bytes context also knows its encoding preferences. (These are knowable in the lexical scope via the $?NF and $?ENC compile-time constants).)

 our List multi list ( *@list )

Forces List Context on it's arguments, and returns them.

 our Item multi item ( $item )

Forces generic Item context on its argument, and returns it.

:16, :8, :2, :10
 our Num multi prefix:<:16> ( Str $hexstr )
 our Num multi prefix:<:8> ( Str $octstr )
 our Num multi prefix:<:2> ( Str $binstr )
 our Num multi prefix:<:10> ( Str $decstr )

Interprets string as a number, with a default hexadecimal/octal/binary/decimal radix. Any radix prefix (0b, 0d, 0x, 0o) mentioned inside the string will override this operator (this statement is true: 10 == :8("0d10")), except 0b and 0d will be interpreted as hex digits by :16 (hex("0d10") == :16 "0d10"). fails on failure.

These aren't really functions, syntactically, but adverbial forms that just happen to allow a parenthesize argument. But more typically you'll see


and such.

Replaces Perl 5 hex and oct.


 our Time multi gmtime ( Time $time? )
 our Time multi method gmtime ( Time $time: )

Identical to:

 our Time multi localtime ( Time $time?, Time::Zone $tz? )
 our Time multi method localtime ( Time $time: Time::Zone $tz? )

Returns a time object whose default timezone is $tz (or the system's default timezone if none is provided).

If used as a function, and no time is provided, the current time is used.

Note that no matter what, $time's concept of "its timezone" is discarded in favor of something new.

 our Time multi time()

Returns a Time object. There are a number of uses for this object, all of which can be found in the documentation for Time.

There is, by default, no timezone associated with this Time object, so whatever default the system has will take over if timezone-specific data is accessed.


 our OS::Name multi gethost()
 our OS::Name multi gethost( Str $name, OS::Addfamily :$type )
 our OS::Name multi method gethost( OS::Addr $addr: ) is export
 our OS::Name multi method gethost( URI $uri: ) is export

The gethost function operates on host naming or address information and returns an OS::Name. An OS::Name is, minimally:

 class OS::Name {
   has Str $.name;
   has OS::Addr $.addr;
   has Array of Str @.aliases;
   has Array of OS::Addr @.addrs;

Such names can apply to anything which has a name that maps to an address, however, in this case the name is a hostname and the address is some sort of network identifier (e.g. an IPV4 address when resolving hosts that have IPV4 addresses).

When stringified, an OS::Name yields its name. When stringified, an OS::addr yields its address in an appropriate text format (e.g. "" for an IPV4 address).

The optional type adverb can be passed when resolving a hostname, and will filter the result to only those addresses that are of the appropriate address family. This feature may be supported by the underlying operating system, or Perl may emulate it.


  say "Connection from {$socket.peer.gethost}";
  my $address = gethost("foo.example.com").addr;
  my $hostname = gethost(:addr<"">);
 our OS::PW multi getpw()
 our OS::PW multi getpw( Int $uid )
 our OS::PW multi getpw( Str $name )

 our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: )
 our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: Int $uid )
 our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: Str $name )

The getpw function operates on system login information, returning data about users in the form of an OS::PW object ("PW" refers to the historical getpw* functions that are part of the POSIX standard, and stands for "password").

When given no parameters, the "next" user entry is returned (undef is returned when the list of users has been exhausted).

When $uid is provided, a user with the given UID is found and returned. undef is returned if no matching entry is found.

When $name is provided, a user with the matching name is found and returned. undef is returned if no matching entry is found.

The return value is an object that represents the system-specific information about the user. When numified, this object returns the UID of the user. When stringified, this object returns the username.

Therefore, the typical convention of:

  my Int $uid = getpw(~$name);


  my Str $name = getpw(+$uid);

Will work as expected.

See the documentation for the OS::PW and OS::PWEnt classes for more information and the equivalent of the Perl 5 setpwent / endpwent functions.

WARNING: Even when used as a method on an OS::PWEnt object, there may be system-specific, global state associated with the implementation of these routines.

[Note: TODO setpgrp setpriority times -ajs ]

 our Bool multi chroot ( Str $path = CALLER::<$_> )

On POSIX systems, changes the context of the current process such that the "root" directory becomes $path and all rooted paths (those that begin with a leading path separator) are relative to that path. For security reasons, many operating systems limit this functionality to the superuser. The return value will be true on success.

 our Str multi getlogin ()

Returns the username of the account running the program. This may not be as secure as using getpwuid on some platforms.

 our Bool multi kill ( OS::Signal $signal, Bool :$group, *@pids )
 our Bool multi method kill ( Proc::PID $pid: OS::Signal $signal?, Bool :$group )

Sends the given $signal to the process(es) given and returns a boolean value indicating success (true) if all of the processes existed and were sent the signal and failure (false) if any of the processes did not exist or the signal could not be delivered to them.

The $signal can be initialized from an integer signal number or a string. Common signals are:

 KILL - stop the process, do not allow it to exit gracefully
 TERM - stop the process, allow it to exit gracefully
 HUP  - Hangup, often used as a request to re-run from scratch
 STOP - Pause execution
 CONT - Continue after a STOP

Consult your operating system documentation for the full list of signal names and numbers. For compatibility, a signal name may be prefixed with "SIG".

The method form may omit the signal. In this case, the default signal is 'TERM'.

If the :group named parameter is passed, kill will attempt to send the signal to a process group rather than a single process. This functionality is platform-specific.

The special signal 0 can be sent which does not actually deliver a signal at all, and is used to determine if processes are still running:

  say "Still running" if $proc.kill(0);
 our Proc::Status multi run ( ; Str $command )
 our Proc::Status multi run ( ; Str $path, *@args )
 our Proc::Status multi run ( Str @path_and_args )

 our Proc multi run ( ; Str $command, Bool :$bg! )
 our Proc multi run ( ; Str $path, Bool :$bg!, *@args )
 our Proc multi run ( Str @path_and_args, Bool :$bg! )

run executes an external program, and returns control to the caller once the program has exited.

The default form expects a single string argument which contains the full command-line. This command-line will be scanned for special characters that the operating system's shell might interpret such as ; or embedded quotes. If any are found, the command will be run through a sub-shell in an operating system specific fashion (on POSIX systems, this means sh -c).

If called like this:

 run( :path<'/some/path'>, 'arg1', 'arg2', ... )

or with a single array (containing both the path and arguments), then the path given is executed directly with no shell interpretation.

The return value is the exit status of the program, and can be evaluated in the following contexts:

 Bool - True = success; False = failure
 Int  - Exit status (per the .exit method)

See wait for more detail on how the Proc::Status object is used.

On failure to execute, an undefined value is returned.

If the :bg named parameter is passed, the program will be executed in the background, and the run command will return as soon as the child process is created. This means that the object returned is actually a Proc, which represents the created process.

[ Note: should the :bg form take rw filehandles or is that over-overloading the functionality of run? Should run be the new open with respect to executing external code? -ajs ]

[ Note: system() should be renamed to sys() or sh() or run() or some such to avoid P5-induced boolean inversion confusion, plus Huffmanize it a little better. I'm thinking run() might be best for MMD reasons. --law

Note: exec should also be renamed to something clearer and "final" and huffmanly longer. I'm thinking runinstead(). And maybe the function behind qq:x should be rungather() rather than readpipe(). -law ]

 multi runinstead ( ; Str $path, *@args )
 multi runinstead ( ; Str $command )

Identical to run except that it never returns. The executed program replaces the currently running program in memory.


There are higher-level models of concurrency management in Perl (see "Concurrency" in S17). These functions are simply the lowest level tools

 our Proc sub Processes::fork()

Creates a copy of the current process. Both processes return from fork. The original process returns the child process as a Proc object. The newly created process returns the parent process as a Proc object. As with any Proc object, the child process object numifies to the process ID (OS dependent integer). However, the parent process object numifies to 0 so that the child and parent can distinguish each other.

Typical usage would be:

 if !defined(my $pid = fork) {
   die "Error calling fork: $!";
 } elsif $pid == 0 {
   say "I am the new child!";
   exit 0;
 } else {
   say "I am the parent of {+$pid}";
 our Proc::Status multi method wait( Proc $process: *%options )

 our Proc::Status multi wait ( Proc $process = -1, *%options )

Waits for a child process to terminate and returns the status object for the child. This status object will numify to the process ID of the child that exited.

Important Proc::Status methods:

 .exit - Numeric exit value
 .pid - Process ID
 .signal - Signal number if any, otherwise 0

For historical reasons there is a .status method which is equal to:

 ($status.exit +< 8) +| $status.signal

If $process is supplied, then wait will only return when the given process has exited. Either a full Proc object can be passed, or just a numeric process ID. A -1 explicitly indicates that wait should return immediately if any child process exits.

When called in this way, the returned Proc::Status object will have a .pid of -1 (which is also what it numifies to) if there was no such process to wait for.

The named options include:


Defaults to true. If set to false, this forces wait to return immediately.


Exists for historical compatibility. WNOHANG = 1> is identical to blocking = False>.


dbmopen, dbmclose
 use DB_File;


format, formline, write

See Exegesis 7.

 use IPC::SysV;

Replaced by temp which, unlike local, defaults to not changing the value.


See "Concurrency" in S17. lock has been replaced by is atomic.


There is no ref() any more, since it was almost always used to get the type name in Perl 5. If you really want the type name, you can use $var.WHAT. If you really want P5 ref semantics, use Perl5::p5ref.

But if you're just wanting to test against a type, you're likely better off performing an isa or does or can, or just $var ~~ TYPE.


Was there a good use for this?


Algorithm was too Anglo-centric. Could be brought back if generalized somehow.


wait can now be called with or without an optional process/pid.

 $num1 % $num2

Does a floating point modulus operation, i.e. 5.5 % 1 == 0.5 and 5 % 2.5 == 0.

Pending Apocalypse

The following functions are classified by Apocalypse/Synopsis numbers.

A/S14: Tied Variables

tie tied untie (now implemented as container classes? my $foo is ....? is tie the meta operation on the container type for 'rebless' - macro tie ( $var, $class, *@args ) { CODE { variable($var).meta.rebless( $class, *@args ) } } )

These are replaced by container types. The compiler is free to assume that any lexical variable is never going to change its container type unless some representation is made to that effect in the declaration. Note: P5's tied() is roughly replaced by P6's variable().

A/S??: OS Interaction

chroot crypt getlogin /[get|set][pw|gr].*/ kill setpgrp setpriority times

... These are probably going to be part of POSIX, automatically imported to GLOBAL if the platform is the right one

Additions ^

Please post errors and feedback to perl6-language. If you are making a general laundry list, please separate messages by topic.

syntax highlighting: