DESCRIPTION§
A (hopefully) comprehensive list of Perl builtin functions with their Raku equivalents with notes on variations between them where necessary.
NOTE§
This document is an attempt to guide you from the functions in Perl's perlfunc
document to their equivalents in Raku. For full documentation on the Raku functions, follow the links in this document to their respective documentation.
One general comment: Raku takes its objects a lot more seriously than Perl. In Raku, everything is an object, although the language is flexible enough to not force you to work in an object oriented manner if you do not wish to do so. What this does mean, however, is that a lot of things that are function calls of the form function(@args)
are now also method calls of the form @args.function
(In rare cases, there is only a method call). This should be obvious in the following text, but it probably behooves you to get into that frame of mind now.
Also, unless otherwise stated, the use of the term "function" here will mean a function in the style of func(@args)
, while "method" will refer to a function in the style of @args.func
.
Alphabetical listing of Perl functions§
Filetests§
-X FILEHANDLE
-X EXPR
-X DIRHANDLE
-X
Raku gives you a couple of options when it comes to file tests. You can do a smartmatch (~~
) or you can call a method.
In Raku, you don't need to actually open a filehandle in the traditional way (although you can) to do a filetest. You can simply append .IO
to the filename. For instance, here is how to check if a file is readable using smartmatch:
'/path/to/file'.IO ~~ :r
You can use an already opened filehandle. Here, using the filehandle $fh
, is an example, using the method syntax for the file test:
.r
Most of the former filetests have colon equivalents for use with smartmatch:
:e Exists |
:d Directory |
:f File |
:l Symbolic link |
:r Readable |
:w Writable |
:x Executable |
:s Size |
:z Zero size |
All of these tests can be used as methods (without the colon).
Three tests, however, only have method equivalents:
.modified; # -M $fh.accessed; # -A $fh.changed; # -C $fh
The remaining filetests in Perl are not implemented in Raku.
The documentation for this can be found at File test operators.
There is more information on reading and writing files at io. Also, the section on open()
below may be helpful.
The Raku ecosystem has a module P5-X
which exports the behavior as much as possible in Raku.
abs§
abs VALUE
Works as a function (abs($x)
), but also as a method. One gotcha, however - method calls bind more tightly than -
, so, for example, -15.abs
evaluates as -(15.abs)
giving you -15
. In this example, you would have to do something like (-15).abs
.
abs
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .abs
rather than simply abs
.
The Raku ecosystem has a module P5math
which exports an abs
function that mimics the original Perl behavior as much as possible.
accept§
accept NEWSOCKET, GENERICSOCKET
accept
is a method you can call on a server, e. g. $server.accept()
. Instead of returning a packed address, it returns a socket, most likely an IO::Socket
object of some sort.
alarm§
alarm SECONDS
alarm()
is no more. But it is possible to have code execute after a certain time has elapsed, or at a given time:
Promise.in(5).then:Promise.at(now + 5).then:
In Raku, this does not involve any (dummy) signals.
atan2§
atan2 Y, X
Available as a function as well as being able to be used as a method. For instance, these are equivalent:
atan2(100);100.atan2;
bind§
bind SOCKET, NAME
[NEEDS FURTHER RESEARCH] No sign of a socket-related bind()
in Raku. At a guess, whatever socket binding is needed happens when you create a new socket object.
binmode§
binmode FILEHANDLE
Instead of this, you would use :bin
as the file mode when opening the socket. E. g. my $fh = open("path/to/file", :bin);
bless§
bless REF, CLASSNAME
With the changes in class creation in Raku, this may find less use than in Perl, and is a method as well as a function. The Raku docs say "Creates a new object of the same type as the invocant, uses the named arguments to initialize attributes, and returns the created object." If you're porting a module from Perl to Raku, it's quite possible you'll want to use new
for creating objects rather than bless
, although there may be some situations in which the latter may still be useful.
break§
break
It does not exist in Raku. For breaking out of given
blocks, you should probably take a look at proceed
and succeed
.
caller§
caller EXPR
There are a couple different ways to get at caller information in Raku. The basic functionality is provided through callframe now. However, Raku constructs call frames for regular blocks, not just for subroutines, so there are more frames to look through. The following will retrieve the basic information that caller
can return:
my = callframe(0); # OR just callframe()my (, );if .code ~~ Routinemy = .file;my = .line;
Many of the other details returned by caller
are specific to Perl and have no meaning in Raku.
You can also get some of the information for the current frame or routine frame by using the dynamic variables &?ROUTINE
, &?BLOCK
, $?PACKAGE
, $?FILE
, and $?LINE
. For many purposes, Backtrace
may provide an easier way to browse through the call stack.
The Raku ecosystem has a module P5caller
which exports a caller
function that mimics the original Perl behavior as much as possible.
chdir§
chdir EXPR
Works as it does in Perl but must take an argument. The behavior of chdir()
(with regards to looking at HOME and LOGDIR) is not supported.
In Raku, chdir only changes the $*CWD
dynamic variable. It does not actually change the default directory from the OS's point of view; the special dynamic-variable routine &*chdir
can be used for that, if needed.
This is done this way, because there is no concept of a "default directory per OS thread". And since Raku does not fork, but only does threading, it was felt that the "current directory" concept should be in the $*CWD
dynamic variable, which can be lexically scoped, and thus can be thread-safe.
The Raku ecosystem has a module P5chdir
which exports a chdir
function that mimics the original Perl behavior as much as possible, including looking at HOME and LOGDIR.
chmod§
chmod LIST
Functions as under Perl, with the difference that octal numbers are represented differently (0o755
rather than 0755
). You may also use it as a method, e. g. $fh.chmod(0o755)
.
chomp§
chomp VARIABLE
The behavior of chomp
is different than in Perl. It leaves the target unaffected and returns a copy of the target with a final logical newline removed, e.g. $x = "howdy\n";$y = chomp($x);
results in $x
containing "howdy\n" and $y
containing "howdy". Also works as a method, e.g. $y = $x.chomp
. As with many other methods, also works with assignment to modify the target in place, e.g. $x.=chomp
results in $x
containing "howdy".
Note that chomp()
(without arguments) is not supported in Raku.
The Raku ecosystem has a module P5chomp
which exports a chomp
function that mimics the original Perl behavior as much as possible.
chop§
chop VARIABLE
As with chomp
, in Raku, this returns the chopped string, rather than chopping in place. I. e. $x = "howdy";$y = chop($x);
results in $x
being "howdy" and $y
being "howd". Also works as a method: $y = $x.chop
.
Note that chop()
(without arguments) is not supported in Raku.
The Raku ecosystem has a module P5chomp
which exports a chop
function that mimics the original Perl behavior as much as possible.
.head2 chown
chown LIST
chown
is not in Raku.
chr§
chr NUMBER
Similar to the Perl version, coerces the target to an integer, and uses that as a Unicode code point to return the relevant character. Can be used as a function and a method:
chr(65); # "A"65.chr; # "A"
Note that chr()
(without arguments) is not supported in Raku.
The Raku ecosystem has a module P5chr
which exports a chr
function that mimics the original Perl behavior as much as possible.
chroot§
chroot FILENAME
chroot
is not in Raku.
close§
close FILEHANDLE
As in Perl, closes a filehandle. Returns a Boolean value. Both close $fh
and $fh.close
will work.
Note that close()
(without arguments) is not supported in Raku.
closedir§
closedir DIRHANDLE
Not supported in Raku.
The Raku ecosystem has a module P5opendir
which exports a closedir
function that mimics the original Perl behavior as much as possible.
connect§
connect SOCKET, NAME
Use connect from IO::Socket::Async
for an asynchronous socket or create an IO::Socket::INET
socket for a synchronous one.
continue§
continue BLOCK
continue
Instead of a continue
block, you should use a NEXT
block. The closest analog to a bare continue;
in Perl appears to be proceed
/succeed
.
cos§
cos EXPR
Works as in Perl.
cos
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .cos
rather than simply cos
.
The Raku ecosystem has a module P5math
which exports a cos
function that mimics the original Perl behavior as much as possible.
crypt§
crypt PLAINTEXT, SALT
Not available in Raku.
The Raku ecosystem has a module P5math
which exports a crypt
function that mimics the original Perl behavior as much as possible.
dbm functions§
dbmclose HASH
dbmopen HASH, DBNAME, MASK
These functions have largely been superseded in Perl, and are unlikely to ever turn up in Raku.
defined§
defined EXPR
Probably does what you expect, but technically it returns False
on the type object, and True
otherwise. This may make more sense when you realize that $num.raku
is the type Any
if you haven't assigned anything to it, and the assigned value if you have. It can be used as a method: $num.defined
. And any newly created class can have its own .defined
method, thereby deciding how and when it should be considered undefined.
Note that defined()
(without arguments) is not supported in Raku.
The Raku ecosystem has a module P5defined
which exports a defined
function that mimics the original Perl behavior as much as possible.
delete§
delete EXPR
Raku replaces this with the new adverb syntax, specifically the :delete
adverb. E. g. my $deleted_value = %hash{$key}:delete;
and my $deleted_value = @array[$i]:delete;
.
die§
die LIST
Works similarly to the Perl version, but Raku's Exception mechanism may give you more power and flexibility than is available in Perl. See exceptions. To omit the stacktrace and location, like Perl's die "...\n"
, use:
note "...";exit 1;
do§
do BLOCK
Similar to the Perl version. Note that there must be a space between the do
and the block.
do EXPR
Has been replaced in Raku by EVALFILE
.
dump§
dump LABEL
According to S29, dump
has been... dumped.
each§
each HASH
There is no exact equivalent, because in Raku Hashes are composed of Pair objects. You can use %hash.kv
which returns a list of keys and values. example: for %hash.kv -> $k, $v { say "$k: $v" }
. However Raku offers more possibilities, %hash.pairs
gives you each Pair object as an entity, and %hash.antipairs
does the same with the keys and values reversed.
Incidentally, what we have there with the ->
is called a pointy block and, though there are a number of examples in the documentation, there doesn't seem to be a really clear explanation of how they work. https://design.raku.org/S04.html#The_for_statement may be of some help here, as well as the design document at https://design.raku.org/S06.html#%22Pointy_blocks%22. There is also some information at https://en.wikibooks.org/wiki/Perl_6_Programming/Blocks_and_Closures#Pointy_Blocks
The Raku ecosystem has a module P5each
which exports an each
function that mimics the original Perl behavior as much as possible.
eof§
eof FILEHANDLE
In Raku, this is not usable as a function, but only as a method. I. e. $filehandle.eof
. Returns True
if at end of file.
eval§
eval EXPR
eval EXPR
The closest replacement is the EVAL function. However, this function has to be allowed explicitly using a pragma to work in the same way. Note that EVAL
does not do any exception handling!
evalbytes§
evalbytes EXPR
No equivalent.
exec§
exec LIST
Nothing in Raku exactly replicates the Perl exec
. shell
and run
are similar to Perl's system
, but exec
's behavior of not returning after executing a system command would have to be emulated by something like shell($command);exit();
or possibly exit shell($command);
.
Neither of these workarounds have the behavior (on Unix-like systems) of replacing your Perl program's process with the new program; notably, they will not work for the practice in some long-running daemons of periodically redoing exec on themselves to reset their state or force operating-system cleanup. Nor will they serve exec
's function of returning stale resources to the operating system.
If you want exec
for these behaviors, you can use an exec*
function via the NativeCall
interface. Consult your operating system manual pages for exec
(or other similarly-named calls such as execl
, execv
, execvp
, or execvpe
). (Beware: these calls are not generally portable between Unix-like operating system families.) Given those caveats, the Raku ecosystem Native::Exec
module exports an exec
function for Unix-like systems.
exists§
exists EXPR
In Raku, this is not a function, but an adverb:
:exists;[]:exists;
exit§
exit EXPR
Appears to do the same thing as in Perl.
exp§
exp EXPR
Same as in Perl.
exp
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .exp
rather than simply exp
.
The Raku ecosystem has a module P5math
which exports an exp
function that mimics the original Perl behavior as much as possible.
fc§
fc EXPR
Looks like it does the same thing as in Perl except that calling it without arguments is not supported in Raku.
The Raku ecosystem has a module P5fc
which exports a fc
function that mimics the original Perl behavior as much as possible.
fcntl§
fcntl FILEHANDLE, FUNCTION, SCALAR
Appears not to be in Raku.
__FILE__§
__FILE__
Replaced by $?FILE
which is slightly different from __FILE__
in that it is always an absolute path, rather than a relative one in the Perl case.
The Raku ecosystem has a module P5__FILE__
which exports a __FILE__
term that mimics the original Perl behavior as much as possible.
fileno§
fileno FILEHANDLE
The native-descriptor
method on IO::Handle
returns the equivalent of fileno
.
The Raku ecosystem has a module P5fileno
which exports a fileno
function that mimics the original Perl behavior as much as possible.
flock§
flock FILEHANDLE, OPERATION
Currently unimplemented.
fork§
fork
There is no built-in fork
function. While it's possible to call it using NativeCall, it's highly unlikely that the resulting process will be usable.
Raku provides extensive support for, and internally uses, threads. However, fork
only clones the thread that called fork
, resulting in a process that will be missing its other threads, which will have been in unknown states and probably holding locks. Even if a Raku program doesn't knowingly start any threads, the compiler may create some of its own in the process of precompilation, and the VMs that Raku runs on also create their own internal worker threads for doing things like optimization and GC in the background. Thus, the presence of threads is pretty much assured, and there's no reasonable way to make fork
reliably work in this case.
formats§
format
formline PICTURE, LIST
Raku does not have built-in formats.
getc§
getc FILEHANDLE
Reads a single character from the input stream as in Perl. May now also be used as a method: $filehandle.getc
getpeername§
getpeername SOCKET
Originally speculated in S29, but not implemented in Raku.
getpgrp§
getpgrp PID
Will not be implemented.
The Raku ecosystem has a module P5getpriority
which exports a getpgrp
function that mimics the original Perl behavior as much as possible.
getppid§
getppid PID
Will not be implemented.
The Raku ecosystem has a module P5getpriority
which exports a getppid
function that mimics the original Perl behavior as much as possible.
getpriority§
getpriority WHICH, WHO
Will not be implemented.
The Raku ecosystem has a module P5getpriority
which exports a getpriority
function that mimics the original Perl behavior as much as possible.
get and set functions§
endpwent
getlogin
getpwent
getpwnam NAME
getpwuid UID
setpwent
The Raku ecosystem has a module P5getpwnam
which exports the endpwent
, getlogin
, getpwent
, getpwnam
, getpwuid
and setpwent
functions that mimic the original Perl behavior as much as possible.
endgrent
getgrent
getgrgid GID
getgrnam NAME
setgrent
The Raku ecosystem has a module P5getgrnam
which exports the endgrent
, getgrent
, getgrgid
, getgrnam
and setgrent
functions that mimic the original Perl behavior as much as possible.
endnetent
getnetbyaddr ADDR, ADDRTYPE
getnetbyname NAME
getnetent
setnetent STAYOPEN
The Raku ecosystem has a module P5getnetbyname
which exports the endnetent
, getnetent
, getnetbyaddr
, getnetbyname
and setnetent
functions that mimic the original Perl behavior as much as possible.
endservent
getservbyname NAME, PROTO
getservbyport PORT, PROTO
getservent
setservent STAYOPEN
The Raku ecosystem has a module P5getservbyname
which exports the endservent
, getservent
, getservbyname
, getservbyport
and setservent
functions that mimic the original Perl behavior as much as possible.
endprotoent
getprotobyname NAME
getprotobynumber NUMBER
getprotoent
setprotoent STAYOPEN
The Raku ecosystem has a module P5getprotobyname
which exports the endprotoent
, getprotoent
, getprotobyname
, getprotobynumber
and setprotoent
functions that mimic the original Perl behavior as much as possible.
gethostbyname NAME
gethostbyaddr ADDR, ADDRTYPE
gethostent
sethostent STAYOPEN
endhostent
[NEEDS FURTHER RESEARCH] Apparently this range of functions are to be handled by roles like User, Group, etc.
getsock*§
getsockname SOCKET
getsockopt SOCKET, LEVEL, OPTNAME
[NEEDS FURTHER RESEARCH] These are likely implemented by some kind of IO::Socket
object, but details are unclear.
glob§
glob EXPR
Not available in core, although some of the functionality is offered by dir routine and its test
argument.
See IO::Glob
module in ecosystem
gmtime§
gmtime EXPR
Like the various parts of localtime
, gmtime
's functionality appears to in the DateTime
object. To get a UTC version of a DateTime
object for the current time, for instance, use my $gmtime = DateTime.now.utc
.
The Raku ecosystem has a module P5localtime
which exports a gmtime
function that mimics the original Perl behavior as much as possible.
goto§
goto LABEL
goto EXPR
goto &NAME
The syntax for goto LABEL
is already accepted, but the runtime part of goto
is not yet implemented. So this will result in a runtime error:
FOO: goto FOO; # Label.goto() not yet implemented. Sorry.
grep§
grep BLOCK LIST
grep EXPR, LIST
Still in Raku, with the caveat that the block form now requires a comma after the block. I.e. @foo = grep { $_ = "bars" }, @baz
. Can also be used as a method: @foo = @bar.grep(/^f/)
hex§
hex EXPR
In Raku an expression must be specified.
Replaced by the adverbial form :16
. E. g. :16("aF")
returns 175. This is Str->Int.
The opposite result can be achieved (Int->Str) by using the .base
method: 0xaF.base(10)
It just so happens that .Str
defaults to base 10, so if you just say 0xaF
, that will also print 175, but that may not be immediately obvious, so may not be the best way to go for this.
The Raku ecosystem has a module P5hex
which exports a hex
function that mimics the original Perl behavior as much as possible.
import§
import LIST
Was never a builtin function in Perl in the first place. In Raku, typically, one declares functions as exportable or not, and all the exportable ones are exported. Nevertheless, selective importing is possible, but beyond the scope of this document. For details, see this section.
index§
index STR, SUBSTR, POSITION
Works as in Perl. Can also now be used as a method: "howdy!".index("how"); # 0
. Main difference with Perl is that Nil
is returned instead of -1
when the substring is not found. This is very useful in combination with the with
command:
with index("foo","o") ->else
The Raku ecosystem has a module P5index
which exports an index
function that mimics the original Perl behavior as much as possible.
int§
int EXPR
There is a truncate
function in Raku (also usable as a method) that does what Perl's int
does. You may want to use that as a direct translation of Perl code, but in Raku, you can just as easily call the .Int
method on the number. 3.9.Int; # 3
and 3.9.truncate
are equivalent.
Please note that int
does have a meaning in Raku. It is type that can be used to indicate a native integer:
my int = 42; # a native integer, similar to Perl's integer values
int
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .int
rather than simply int
.
The Raku ecosystem has a module P5math
which exports an int
function that mimics the original Perl behavior as much as possible.
ioctl§
ioctl FILEHANDLE, FUNCTION, SCALAR
Currently unimplemented in Raku.
join§
join EXPR, LIST
Works as in Perl, and also works as a method: @x.join(",")
keys§
keys HASH
Works as in Perl, and can also be used as a method: %hash.keys
kill§
kill SIGNAL, LIST
kill SIGNAL
No pre-defined core alternative exists. A non-portable method can be to use NativeCall:
use NativeCall;sub kill(int32, int32) is native ;kill , 9; # OUTPUT: «Killed»
To kill processes that were started by creating a Proc::Async
, use Proc::Async.kill
method.
last§
last LABEL
last EXPR
last
Same as in Perl.
lc§
lc EXPR
Works as in Perl, and also as a method: "UGH".lc
. In Raku an expression must be specified.
The Raku ecosystem has a module P5lc
which exports an lc
function that mimics the original Perl behavior as much as possible.
lcfirst§
lcfirst EXPR
Does not exist in Raku.
The Raku ecosystem has a module P5lcfirst
which exports an lcfirst
function that mimics the original Perl behavior as much as possible.
length§
length EXPR
Replaced by chars
, typically used as a method ($string.chars
), but also works as a function.
The Raku ecosystem has a module P5length
which exports a length
function that mimics the original Perl behavior as much as possible.
__LINE__§
__LINE__
Replaced by $?LINE
.
The Raku ecosystem has a module P5__FILE__
which exports a __LINE__
term that mimics the original Perl behavior as much as possible.
link§
link OLDFILE, NEWFILE
See link
listen§
listen SOCKET, QUEUESIZE
Not clearly documented, but it appears that listen
will be a method you would call on some variety of IO::Socket
object.
local§
local EXPR
The Raku equivalent is temp
. Unlike local
, however, the value of the given variable is not immediately unset: it retains its original value until assigned to.
localtime§
localtime EXPR
Most of the functionality of localtime
is found in DateTime
. The specific parts of localtime
can be found as follows:
my = DateTime.now;my = .second; # Potentially includes fractional secondsmy = .minute;my = .hour;my = .day-of-month; # or $d.day; 1..31my = .month; # 1..12my = .year;my = .day-of-week; # 1 => Monday, 2 => Tuesday, etc.my = .day-of-year; # 1..366
Please note that ranges are not 0-based in Raku, as shown in the comments in the example.
There does not currently appear to be a way to get Perl's $isdst
. Also, the result of scalar(localtime)
that Perl provides is not available. $d.Str
will give something along the lines of "2015-06-29T12:49:31-04:00".
The Raku ecosystem has a module P5localtime
which exports a localtime
function that mimics the original Perl behavior as much as possible.
lock§
lock THING
There currently is no equivalent for this In Raku. There is a Lock
class for creating a Lock object, that can be locked/unlocked as needed. But such a lock does not refer to any external objects.
log§
log EXPR
Same as in Perl.
log
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .log
rather than simply log
.
The Raku ecosystem has a module P5math
which exports a log
function that mimics the original Perl behavior as much as possible.
lstat§
lstat FILEHANDLE
lstat EXPR
lstat DIRHANDLE
lstat
Likely implemented somewhere in one of the IO
classes in Raku, but it is not clear where at this time.
m//§
m//
Regular expression syntax is somewhat different in Raku, but the match operator still exists. If you're trying to rewrite some Perl code, the most important difference is that =~
is replaced by the smartmatch operator, ~~
. Similarly, !~
is replaced by !~~
. Options for regex operators are adverbs and are complicated. For details, see Adverbs
map§
map BLOCK LIST
map EXPR, LIST
As a function, the only difference between Perl and Raku is that, if you're using a block, the block must be followed by a comma. Can also be used as a method: @new = @old.map: { $_ * 2 }
mkdir§
mkdir FILENAME, MASK
mkdir FILENAME
Works as in Perl. When giving a multi-level directory specification, it will automatically create non-existing intermediate directories with the same MASK (similar to what "make_path" does of the File::Path module in Perl).
mkdir
The zero argument (implicit $_
) version is not permitted in Raku.
msg*§
msgctl ID, CMD, ARG
msgget KEY, FLAGS
msgrcv ID, VAR, SIZE, TYPE, FLAGS
msgsnd ID, MSG, FLAGS
Not builtins in Raku. May appear in an external module at some point. Maybe.
my§
my VARLIST
my TYPE VARLIST
my VARLIST : ATTRS
my TYPE VARLIST : ATTRS
Works as in Perl.
next§
next LABEL
next EXPR
next
The same in Raku.
no§
no MODULE VERSION
no MODULE LIST
no MODULE
no VERSION
In Raku, this is usable for pragmas such as strict
, but not for modules or versions.
oct§
oct
Replaced by the adverbial form :8
. E. g. :8("100")
returns 64.
If you want to deal with strings that start in 0x
, 0o
, or 0b
, you can just use the prefix:<+>
operator.
The Raku ecosystem has a module P5hex
which exports an oct
function that mimics the original Perl behavior as much as possible.
open§
open FILEHANDLE, EXPR
open FILEHANDLE, MODE, EXPR
open FILEHANDLE, MODE, EXPR, LIST
open FILEHANDLE, MODE, REFERENCE
open FILEHANDLE
The most obvious change from Perl is the file mode syntax. To open a file for reading only, you would say open("file", :r)
. For write- only, read-write, and append, you would use :w
, :rw
, and :a
respectively. There are also options for encoding and how the filehandle deals with newlines. Details here.
Another important change is that filehandles don't get automatically closed on scope exit. It's necessary to call close explicitly.
opendir§
opendir DIRHANDLE, EXPR
No replacement. See &dir
/IO::Path.dir
for alternatives.
The Raku ecosystem has a module P5opendir
which exports an opendir
function that mimics the original Perl behavior as much as possible.
ord§
ord EXPR
Same as in Perl. May be used as a method: "howdy!".ord; # 104
Note that ord()
(without arguments) is not supported in Raku.
The Raku ecosystem has a module P5chr
which exports an ord
function that mimics the original Perl behavior as much as possible.
our§
our VARLIST
our TYPE VARLIST
our VARLIST : ATTRS
our TYPE VARLIST : ATTRS
The same in Raku.
pack§
pack TEMPLATE, LIST
Available in Raku when use experimental :pack
has been specified in the scope where pack
needs to be called. The template options are currently more restricted than they are in Perl. The current documented list can be found at unpack.
The Raku ecosystem has a module P5pack
which exports a pack
function that mimics the original Perl behavior as much as possible and which has a bigger set of supported features than the experimental Raku version.
package§
package NAMESPACE
package NAMESPACE VERSION
package NAMESPACE BLOCK
package NAMESPACE VERSION BLOCK
S10 indicates that package
can be used in Raku, but only with a block. I. e. package Foo { ... }
means that the code within the block would be in package Foo. There is a special case where a declaration of the form package Foo;
as the first statement in a file indicates that the rest of the file is Perl code, but the usefulness of this is unclear. In fact, as modules and classes are declared with distinct keywords (such as class
), it's unlikely you will use package
directly in Raku.
__PACKAGE__§
__PACKAGE__
Replaced by $?PACKAGE
which is slightly different from __PACKAGE__
in that it is the actual package object. You should call the .^name
method on it to get a string.
The Raku ecosystem has a module P5__FILE__
which exports a __PACKAGE__
term that mimics the original Perl behavior as much as possible.
pipe§
pipe READHANDLE, WRITEHANDLE
Depending on your needs, see Channel
to shuttle data between threads (and Concurrency tutorial for other options), or see Proc
type for piping to and from processes.
pop§
pop ARRAY
Works in Raku, and can also be used as a method. I. e. my $x = pop @a;
and my $x = @a.pop;
are equivalent.
The non-parameter version of pop
does not exist. Also, if the array is empty, a Failure will be returned in Raku, which will throw if the value is actually used in a significant way.
If you are using only defined values in your array, you can use the with
function to handle this case:
with pop ->else
The Raku ecosystem has a module P5push
which exports a pop
function that mimics the original Perl behavior as much as possible.
pos§
pos SCALAR
Not available in Raku. The closest equivalent is the :c
adverb, which defaults to $/.to
if $/
is true, and 0
if it isn't. For information on :c
, see Continue.
print§
print FILEHANDLE LIST
print FILEHANDLE
print LIST
print
print
can be used as a function in Raku, writing to standard out. To use print
as a function with a filehandle instead of standard out, you can use a method call: $fh.print("howdy!")
The Raku ecosystem has a module P5print
which exports a print
function that mimics the original Perl behavior as much as possible.
printf§
printf FORMAT, LIST
printf
Raku version is similar; see sprintf for details on acceptable format directives. To print to a filehandle other than STDOUT, use the .printf
method on that filehandle.
The Raku ecosystem has a module P5print
which exports a printf
function that mimics the original Perl behavior as much as possible.
prototype§
prototype FUNCTION
Not available in Raku. The closest equivalent is .signature
. E. g. say &sprintf.signature
results in "(Cool $format, *@args)".
push§
push ARRAY, LIST
Works as in Perl, as well as being available as a method: @a.push("foo");
. Note: the flattening behavior is different in Raku: @b.push: @a
will push @a
into @b
as a single element. See also the append method.
Also note that push
in Raku returns the array to which was pushed, contrary to Perl where it returns the new number of elements.
The Raku ecosystem has a module P5push
which exports a push
function that mimics the original Perl behavior as much as possible.
quoting§
q/STRING/
qq/STRING/
qw/STRING/
qx/STRING/
These survive the transition to Raku. Some notes:
q/.../; # is still equivalent to using single quotes.
qq/.../; # is still equivalent to using double quotes.
qw/.../; # is more commonly written as <...> in Raku.
There are some added quoting constructs and equivalents, as explained at quoting.
Has been replaced by rx/.../
.
quotemeta EXPR
No direct equivalent, i.e. nothing that just returns the string with all the ASCII non-word characters backslashed. In regexes, however, using $foo
will treat $foo
as a literal string, and using <$foo>
will interpret the contents of $foo
as regex code. Note that the angle brackets are doing something different here than they do outside a regex. For more information on this, see https://design.raku.org/S05.html#Extensible_metasyntax_(%3C...%3E)
The Raku ecosystem has a module P5quotemeta
which exports a quotemeta
function that mimics the original Perl behavior as much as possible.
rand§
rand EXPR
rand
by itself works as it does in Perl, but you can no longer give it an argument. You can, however, use it as a method on a number to get that behavior. I. e. the Perl rand(100)
is equivalent to 100.rand
in Raku. Additionally, you can get a random integer by using something like (^100).pick
. For why you are able to do that, see ^ operator and pick.
The Raku ecosystem has a module P5math
which exports a rand
function that mimics the original Perl behavior as much as possible.
read§
read FILEHANDLE, SCALAR, LENGTH, OFFSET
read
is found in IO::Handle
and IO::Socket
in Raku. It reads the specified number of bytes (rather than characters) from the relevant handle or socket. The use of an offset available in Perl is not documented to exist at this time.
readdir§
readdir DIRHANDLE
Not a builtin function. To iterate through the contents of a directory, take a look at dir routine.
The Raku ecosystem has a module P5opendir
which exports a readdir
function that mimics the original Perl behavior as much as possible.
readline§
readline
Not available in Raku. You most likely want to use the .lines
method in some way. For more detailed information on reading from files, see io.
readlink§
readlink EXPR
Appears to be gone from Raku. There is a method resolve
in IO::Path
that will follow symlinks if the OS / Filesystem supports them.
The Raku ecosystem has a module P5readlink
which exports a readlink
function that mimics the original Perl behavior as much as possible.
readpipe§
readpipe EXPR
readpipe
Doesn't appear to be working in Raku, but qx//
is functional, so it might be lurking around in some class that isn't obvious.
recv§
recv SOCKET, SCALAR, LENGTH, FLAGS
Appears to be in IO::Socket
. Not extensively documented at this time.
redo§
redo LABEL
redo EXPR
redo
Unchanged in Raku.
ref§
ref EXPR
Gone. To quote S29, "If you really want the type name, you can use $var.WHAT.^name
.
The Raku ecosystem has a module P5ref
which exports a ref
function that mimics the original Perl behavior as much as possible.
rename§
rename OLDNAME, NEWNAME
Still available in Raku.
requires§
require VERSION
No equivalent.
reset§
reset EXPR
No equivalent.
The Raku ecosystem has a module P5reset
which exports a reset
function that mimics the original Perl behavior as much as possible.
return§
return EXPR
Appears to be available in Raku, although not clearly documented.
reverse§
reverse LIST
In Raku, this only reverses the elements of a list. reverse(@a)
or @a.reverse
. To reverse the characters in a string, use the .flip
method.
reverse
without parameters is not supported in Raku.
The Raku ecosystem has a module P5reverse
which exports a reverse
function that mimics the original Perl behavior as much as possible.
rewinddir§
rewinddir DIRHANDLE
Not supported in Raku.
The Raku ecosystem has a module P5opendir
which exports a rewinddir
function that mimics the original Perl behavior as much as possible.
rindex§
rindex STR, SUBSTR, POSITION
Works as in Perl, and may also be used as a method. E. g. $x = "babaganush";say $x.rindex("a"); say $x.rindex("a", 3); # 5, 3
. Main difference with Perl is that Nil
is returned instead of -1
when the substring is not found. This is very useful in combination with the with
command:
with index("foo","o") ->else
The Raku ecosystem has a module P5index
which exports a rindex
function that mimics the original Perl behavior as much as possible.
rmdir§
rmdir FILENAME
Works in Raku and can also be used as a method. rmdir "Foo";
and "Foo".IO.rmdir;
are equivalent.
s///§
s///
Regular expression syntax is somewhat different in Raku, but the substitution operator exists. If you're trying to rewrite some Perl code, the most important difference is that =~
is replaced by the smartmatch operator, ~~
. Similarly, !~
is !~~
. Options for regex operators are adverbs and are complicated. For details, see Adverbs page
say§
say FILEHANDLE
say LIST
say
say
can be used as a function, defaulting to standard out. To use say
as a function with a filehandle instead of standard out, you need to put a colon after the filehandle. I. e. say $fh: "Howdy!"
. The use of the colon as an "invocant marker" here is discussed at https://design.raku.org/S03.html#line_4019. Alternately, you can use a method call: $fh.say("howdy!")
The Raku ecosystem has a module P5print
which exports a say
function that mimics the original Perl behavior as much as possible.
scalar§
scalar EXPR
Gone. Apparently "very" gone.
Some functions of the modules created for the CPAN Butterfly Plan accept a :scalar
named parameter to indicate that the scalar
behavior of the function is required.
seek§
seek FILEHANDLE, POSITION, WHENCE
Not documented in any real way yet, but listed as a method of the IO::Handle
class.
The Raku ecosystem has a module P5seek
which exports a seek
function that mimics the original Perl behavior as much as possible.
seekdir§
seekdir DIRHANDLE, POS
Not supported in Raku.
The Raku ecosystem has a module P5opendir
which exports a seekdir
function that mimics the original Perl behavior as much as possible.
select§
select FILEHANDLE
"[S]elect as a global concept is dead." When I asked around about select
, I was told that $*OUT and such are overridable in dynamic scope, and that IO::Capture::Simple
(at https://github.com/sergot/IO-Capture-Simple) may be of use for something you might be doing with the value of select
.
semctl§
semctl ID, SEMNUM, CMD, ARG
No longer in core.
semget§
semget KEY, NSEMS, FLAGS
No longer in core.
semop§
semop KEY, OPSTRING
No longer in core.
send§
send SOCKET, MSG, FLAGS, TO
Can be found in the IO::Socket
class.
setpgrp§
setpgrp PID, PGRP
Will not be implemented.
The Raku ecosystem has a module P5getpriority
which exports a setpgrp
function that mimics the original Perl behavior as much as possible.
setpriority§
setpriority WHICH, WHO, PRIORITY
Will not be implemented.
The Raku ecosystem has a module P5getpriority
which exports a setpriority
function that mimics the original Perl behavior as much as possible.
setsockopt§
setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL
Not documented, but probably hiding in an IO
class somewhere.
shift§
shift ARRAY
shift EXPR
shift
Works in Raku, and can also be used as a method. I. e. my $x = shift @a;
and my $x = @a.shift;
are equivalent.
The non-parameter version of shift
does not exist. Also, if the array is empty, a Failure will be returned in Raku, which will throw if the value is actually used in a significant way.
If you are using only defined values in your array, you can use the with
function to handle this case:
with shift ->else
The Raku ecosystem has a module P5shift
which exports a shift
function that mimics the original Perl behavior as much as possible.
shm*§
shmctl ID, CMD, ARG
shmget KEY, SIZE, FLAGS
shmread ID, VAR, POS, SIZE
shmwrite ID, STRING, POS, SIZE
Gone from the core. May turn up in a module somewhere.
shutdown§
shutdown SOCKET, HOW
Not documented, but likely moved into IO::Socket
.
sin§
sin EXPR
Same as in Perl.
sin
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .sin
rather than simply sin
.
The Raku ecosystem has a module P5math
which exports a sin
function that mimics the original Perl behavior as much as possible.
sleep§
sleep EXPR
Still works as in Perl, but is not limited to integer values for seconds. And it always returns Nil.
If you're interested in the return values of sleep
to ensure sleeping until a specified time, then you should use sleep-until
in Raku (which takes an Instant
).
If you're interested in running some code every N seconds, and you don't care on which thread it runs, you should probably use react
and whenever
with a Supply.interval
.
The Raku ecosystem has a module P5sleep
which exports a sleep
function that mimics the original Perl behavior as much as possible.
sockets§
socket SOCKET, DOMAIN, TYPE, PROTOCOL
socketpair SOCKET1, SOCKET2, DOMAIN, TYPE, PROTOCOL
Not currently documented, but will likely wind up in IO::Socket
.
sort§
sort SUBNAME LIST
sort
exists in Raku, but is somewhat different. $a
and $b
are no longer special (see Special Variables) and sort routines no longer return positive integers, negative integers, or 0, but rather Order::Less
, Order::Same
, or Order::More
objects. See sort for details. May also be used as a method I. e. sort(@a)
is equivalent to @a.sort
.
splice§
splice ARRAY, OFFSET, LENGTH
splice ARRAY, OFFSET
splice ARRAY
splice EXPR, OFFSET, LENGTH, LIST
splice EXPR, OFFSET, LENGTH
splice EXPR, OFFSET
splice EXPR
Available in Raku. Can also be used as a method. splice(@foo, 2, 3, <M N O P>)
is equivalent to @foo.splice(2, 3, <M N O P>);
.
split§
split /PATTERN/, EXPR, LIMIT
split /PATTERN/, EXPR
split /PATTERN/
Works mostly as in Perl. There are some exceptions, though. To get the special behavior of using the empty string, you must actually use the empty string - the special case of the empty pattern //
being treated as the empty string does not apply. If you use a regex for the split, it will use the regex, while a literal string will be treated literally. If you wish to have the delimiters included in the resulting list, you need to use the named parameter :all
, like this: split(';', "a;b;c", :all) # a ; b ; c
Empty chunks are not removed from the result list as they are in Perl. For that behavior, see comb
. Details on split
are here. Unsurprisingly, split
also now works as a method: "a;b;c".split(';')
split
split
now requires a pattern. For the equivalent of Perl's behavior of splitting on whitespace when no pattern is specified, use words (or use split
with /\s+/
as the pattern and :skip-empty
as a named argument).
sprintf§
sprintf FORMAT, LIST
Works as in Perl. The formats currently available 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 uppercase letters |
E | like e, but using an uppercase "E" |
G | like g, but with an uppercase "E" (if applicable) |
Compatibility:
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 (non-)compatibility:
n | produces a runtime exception |
p | produces a runtime exception |
There are modifiers for integers, but they're mainly no-ops, as the semantics aren't settled:
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) |
sqrt§
sqrt EXPR
Same as in Perl.
sqrt
also operates on $_
in the absence of a value, but not as a function, and as a method you need to call it as .sqrt
rather than simply sqrt
.
The Raku ecosystem has a module P5math
which exports a sqrt
function that mimics the original Perl behavior as much as possible.
srand§
srand EXPR
Available in Raku.
stat§
stat EXPR
stat DIRHANDLE
stat
Unlikely to be implemented as a built in function since it's POSIX specific, but available through the NativeCall
interface.
state§
state VARLIST
state TYPE VARLIST
state VARLIST : ATTRS
state TYPE VARLIST : ATTRS
Available in Raku, see state.
study§
study SCALAR
study
study
is no more.
The Raku ecosystem has a module P5study
which exports a study
function that mimics the original Perl behavior as much as possible.
sub§
sub NAME BLOCK
sub NAME(PROTO) BLOCK
sub NAME : ATTRS BLOCK
sub NAME(PROTO) : ATTRS BLOCK
Unsurprisingly, we still have subroutines! You can have a signature in your subroutine which allows you to specify arguments. Nevertheless, in the absence of a signature (and only in the absence of a signature), @_
still contains what is passed to the function. So, in theory, you don't need to change that aspect of a function if porting from Perl to Raku (although you should probably consider the option of using a signature). For all the gory details, see functions.
__SUB__§
__SUB__
Replaced by &?ROUTINE
which is slightly different from __SUB__
in that it is the actual Sub
(or Method
) object. You should call the .name
method on it to get a string.
The Raku ecosystem has a module P5__FILE__
which exports a __SUB__
term that mimics the original Perl behavior as much as possible.
substr§
substr EXPR, OFFSET, LENGTH, REPLACEMENT
See substr-rw.
Can be used as a function or a method. Can't be used on Str
literals, as they are immutable.
my = 'Cheesy';.substr-rw(4,1)="k"; # returns 'k'say ; # OUTPUT: «Cheeky»substr-rw(, 0, 3) = "Lea";say ; # OUTPUT: «Leaky»
substr EXPR, OFFSET, LENGTH
substr EXPR, OFFSET
See substr.
Can be used as a function or a method. substr("hola!", 1, 3)
and "hola!".substr(1, 3)
both return "ola".
symlink§
symlink OLDFILE, NEWFILE
See symlink.
syscall§
syscall NUMBER, LIST
Not a builtin in Raku. Most likely out in a module somewhere, but it's currently unclear where.
sys*§
sysopen FILEHANDLE, FILENAME, MODE
sysopen FILEHANDLE, FILENAME, MODE, PERMS
sysread FILEHANDLE, SCALAR, LENGTH, OFFSET
sysread FILEHANDLE, SCALAR, LENGTH
sysseek FILEHANDLE, POSITION, WHENCE
As with the non-sys versions of these functions, are probably lurking in the IO
classes somewhere.
system§
system LIST
system PROGRAM LIST
For this, you probably want (run) or (shell routine).
syswrite§
syswrite FILEHANDLE, SCALAR, LENGTH, OFFSET
syswrite FILEHANDLE, SCALAR, LENGTH
syswrite FILEHANDLE, SCALAR
As with sysopen
and friends, this has moved into the IO
classes.
tell§
tell FILEHANDLE
As a method on IO::Handle
.
telldir§
telldir DIRHANDLE
Not supported in Raku.
The Raku ecosystem has a module P5opendir
which exports a telldir
function that mimics the original Perl behavior as much as possible.
tie§
tie VARIABLE, CLASSNAME, LIST
tied VARIABLE
The Raku alternative to tying a scalar, is the Proxy
container. For example:
sub lval()
This makes lval
a left-value sub. Whenever the value is requested, the FETCH
method is called. And whenever it is used in an assignment, the STORE
method is called.
For arrays and hashes (objects that do the Positional
and/or Associative
role), one only needs to provide the methods that these roles require to get the functionality that tie
provides in Perl. These are documented in the Subscripts
section.
The Raku ecosystem has a module P5tie
which exports tie
/ tied
functions that mimics the original Perl behavior as much as possible.
time§
time
Number of seconds since epoch (as an Int
), same as in Perl.
times§
times
Not available in Raku.
The Raku ecosystem has a module P5times
which exports a times
function that mimics the original Perl behavior as much as possible.
tr///§
tr///
Works similarly to how it does in Perl. The one caveat is that ranges are specified differently. Instead of using a range "a-z", you would use "a..z", i.e. with Perl's range operator. In Raku, tr///
has a method version, called trans, which offers a few additional features.
Perl's /r
flag is instead implemented as TR///
operator. The y///
equivalent does not exist.
truncate§
truncate FILEHANDLE, LENGTH
truncate EXPR, LENGTH
Not currently implemented (2018.04).
uc§
uc EXPR
Works as a function and a method. uc("ha")
and "ha".uc
both return "HA". There is no support for the parameterless version.
The Raku ecosystem has a module P5lc
which exports a uc
function that mimics the original Perl behavior as much as possible.
ucfirst§
ucfirst EXPR
ucfirst
Raku has done away with ucfirst
. The titlecase function tc
or tclc
probably does what you need; in the first case, it does "titlecase", which might correspond to different characters in different alphabets; it defaults to uppercase if there's no titlecase mapping. On the other hand, tclc
applies tc
and then puts the rest of the characters in lowercase.
The Raku ecosystem has a module P5lcfirst
which exports a ucfirst
function that mimics the original Perl behavior as much as possible.
undef§
undef EXPR
There is no undef
in Raku. You can't undefine a function, and the closest equivalent value is probably Nil
, but you'll likely have no use for that.
If you were using something like (undef, $file, $line) = caller;
, you would just get the filename and line number directly in Raku instead of discarding the first result of caller
. caller
has been replaced by callframe
in Raku, so the equivalent statement would be ($file, $line) = callframe.annotations<file line>;
The Raku ecosystem has a module P5defined
which exports an undef
function that mimics the original Perl behavior as much as possible.
unlink§
unlink LIST
Still available. Usable as a method: "filename".IO.unlink
unlink
The zero argument (implicit $_
) version of unlink is not available in Raku.
unpack§
unpack TEMPLATE, EXPR
unpack TEMPLATE
Available in Raku when use experimental :pack
has been specified in the scope where unpack
needs to be called. The template options are currently more restricted than they are in Perl. The current documented list can be found at unpack.
The Raku ecosystem has a module P5pack
which exports an unpack
function that mimics the original Perl behavior as much as possible and which has a bigger set of supported features than the experimental Raku version.
unshift§
unshift ARRAY, LIST
unshift EXPR, LIST
Works as in Perl, as well as being available as a method: @a.unshift("foo");
. Note: the flattening behavior is different in Raku: @b.unshift: @a
will unshift @a
into @b
as a single element. See also the prepend method.
Also note that unshift
in Raku returns the array to which was pushed, contrary to Perl where it returns the new number of elements.
The Raku ecosystem has a module P5shift
which exports an unshift
function that mimics the original Perl behavior as much as possible.
untie§
untie VARIABLE
Not supported in Raku, but see tie for the whole story.
The Raku ecosystem has a module P5tie
which exports an untie
function that mimics the original Perl behavior as much as possible.
use§
use Module VERSION LIST
use Module VERSION
use Module LIST
use Module
use VERSION
In Perl, this requires a minimum version of the perl executable in order to run. In Raku, this requires a version of the specification, (e.g. 6.c
), which can be implemented by various Raku executables.
utime§
utime LIST
No equivalent.
values§
values HASH
values ARRAY
values EXPR
Available in Raku. Can also be used as a method. values %hash
is equivalent to %hash.values
.
vec§
vec EXPR, OFFSET, BITS
There is no support for vec() in Raku.
S29 says "Should replace vec
with declared buffer/array of bit
, uint2
, uint4
, etc." Support for bit
, uint2
, uint4
has not landed yet. But support for uint8
, int8
, uint16
, int16
, uint32
, int32
, uint64
, int64
as well as the system sized uint
and int
have landed. In scalar forms, as well as in array and shaped array (aka matrix) forms.
wait§
wait
[NEEDS FURTHER RESEARCH] Unclear where this has gone. There's a wait
method in Supply
, and an await
method in both Channel
and Promise
. Which, if any or all, of these is a direct equivalent of Perl's wait
is unclear.
waitpid§
waitpid PID, FLAGS
As with wait
, the disposition of this is unclear.
wantarray§
wantarray
There is no wantarray
in Raku; however, there are very easy ways to cover many of the use cases which wantarray filled.
First, since Raku does not need special reference syntax to contain a List
or Array
in a Scalar
, simply returning a list may be all that is needed:
sub listofstuffmy = listofstuff();print ; # OUTPUT: «1 2 3»print join("<", listofstuff()) # OUTPUT: «1<2<3»
One of the most common use cases is to provide either an array of lines or elements, or a prettier string than would be produced by simply printing the array. One can mix in a custom .Str
method for this purpose:
sub prettylist(*)print prettylist(1, 2, 3); # OUTPUT: «1<2<3»print join(">", prettylist(3, 2, 1)); # OUTPUT: «3>2>1»
In the above example, the returned list may be lazy, and the .Str
method is not called until stringification happens, so no extra work is done to generate something which is not asked for.
Another use case is to create methods which are mutators when called in void context but produce copies during assignment. It is generally considered better form in Raku not to do so, even more so because void context does not exist in Raku, with the closest equivalent being sink context, since users can quite easily turn any copy-producing method into a mutator using the .=
operator:
my = "foo\n";.ords.say; # OUTPUT: «(102 111 111 10)».= chomp;.ords.say; # OUTPUT: «(102 111 111)»
However if you have your heart set on using the same function name for both operations, you can get most of the way there by mixing in a .sink
method, which will be called when the result finds itself in sink context. There are some caveats however, so again, this is not advised:
multi increment( is rw)multi increment()my = 1;increment();say ; # OUTPUT: «2»my = increment();say "$a $b"; # OUTPUT: «2 3»# ...users will just have to be aware that they should not accidentally# sink a stored value later, though this requires some effort to# actually do:sub identity( is rw) ;= 1;= increment();identity();.say; # OUTPUT: «2»
warn§
warn LIST
warn
throws a resumable exception. To simply print a message to $*ERR
, you would use the note
function. For more on exceptions, see Exceptions.
write§
write FILEHANDLE
write EXPR
write
Formats are gone from Raku, so this no longer works.
y///§
y///
This synonym for tr///
is gone. For functionality, see the entry for tr///
.