CINXE.COM
Raku language documentation | Raku Documentation
<!DOCTYPE html> <html lang="en" class="fontawesome-i2svg-active fontawesome-i2svg-complete" style="scroll-padding-top:60px"> <head> <title>Raku language documentation | Raku Documentation</title> <meta charset="UTF-8" /> <link href="/assets/images/Camelia.ico" rel="icon" type="image/x-icon"/> <link rel="stylesheet" href="/assets/css/Website.css"/> <link rel="stylesheet" href="/assets/css/typegraph-styling.css"/> <link rel="stylesheet" href="/assets/css/typegraph-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/typegraph-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/css/filtered-toc-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/filtered-toc-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/css/announce-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/css/announce-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/all.min.css"/> <link rel="stylesheet" href="/assets/css/listf-styling-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/listf-styling-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/options-search-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/css/options-search-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/page-styling-main.css"/> <link rel="stylesheet" href="/assets/css/css/page-styling-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/page-styling-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/css/chyronToggle-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/chyronToggle-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/css/centreToggle-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/centreToggle-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/tm-styling.css"/> <link rel="stylesheet" href="/assets/css/tm-light.css" title="light"/> <link rel="stylesheet" href="/assets/css/tm-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/rainbow-dark.css" title="dark"/> <link rel="stylesheet" href="/assets/css/css/rainbow-light.css" title="light"/> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/css/autoComplete.min.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-light.min.css" title="light" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css" title="dark" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="/assets/scripts/all.min.js"></script><script src="/assets/scripts/filter-script.js"></script><script src="/assets/scripts/tableManager.js"></script><script src="https://cdn.jsdelivr.net/npm/fuzzysort@2.0.4/fuzzysort.min.js"></script><script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/autoComplete.min.js"></script><script src="/assets/scripts/filtered-toc.js"></script><script src="/assets/scripts/options-search.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/haskell.min.js"></script><script src="/assets/scripts/page-styling.js"></script><script src="/assets/scripts/announcements.js"></script><script src="/assets/scripts/rainbow.js"></script> </head> <body class="has-navbar-fixed-top"> <div id="Raku_language_documentation" class="top-of-page"></div> <nav class="navbar is-fixed-top is-flex-touch" role="navigation" aria-label="main navigation"> <div class="navbar-item" style="margin-left: auto;"> <div class="left-bar-toggle" title="Toggle Table of Contents & Index"> <label class="chyronToggle left"> <input id="navbar-left-toggle" type="checkbox"> <span class="text">Contents</span> </label> </div> </div> <div class="container is-justify-content-space-around"> <div class="navbar-brand"> <div class="navbar-logo"> <a class="navbar-item" href="/"> <img src="/assets/images/camelia-recoloured.png" alt="Raku" width="52.83" height="38"> </a> <span class="navbar-logo-tm">tm</span> </div> <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navMenu"> <span aria-hidden="true"></span> <span aria-hidden="true"></span> <span aria-hidden="true"></span> </a> </div> <div id="navMenu" class="navbar-menu"> <div class="navbar-start"> <a class="navbar-item" href="/introduction" title="Getting started, Tutorials, Migration guides"> Introduction </a> <a class="navbar-item" href="/reference" title="Fundamentals, General reference"> Reference </a> <a class="navbar-item" href="/miscellaneous" title="Programs, Experimental"> Miscellaneous </a> <a class="navbar-item" href="/types" title="The core types (classes) available"> Types </a> <a class="navbar-item" href="/routines" title="Searchable table of routines"> Routines </a> <a class="navbar-item" href="https://raku.org" title="Home page for community"> Raku<sup>庐</sup> </a> <a class="navbar-item" href="https://web.libera.chat/#raku" title="IRC live chat"> Chat </a> <div class="navbar-item has-dropdown is-hoverable"> <a class="navbar-link"> More </a> <div class="navbar-dropdown is-right is-rounded"> <hr class="navbar-divider"> <a class="navbar-item js-modal-trigger" data-target="download-ebook"> Download E-Book (epub) </a> <hr class="navbar-divider"> <a class="navbar-item" href="/about"> About </a> <hr class="navbar-divider"> <a class="navbar-item has-text-red" href="https://github.com/raku/doc-website/issues"> Report an issue with this site </a> <hr class="navbar-divider"> <a class="navbar-item" href="https://github.com/raku/doc/issues"> Report an issue with the documentation content </a> <hr class="navbar-divider"> <label class="navbar-item centreToggle" title="Enable/Disable Announcements" style="--switch-width: 18"> <input id="cancelAnnouncements" type="checkbox"> <span class="text">Announcements</span> <span class="on">suppressed</span> <span class="off">allowed</span> </label> </div> </div> </div> <div class="navbar-end navbar-search-wrapper"> <div class="navbar-item"> <div class="field has-addons"> <div class="autoComplete_options"> <input class="control input" id="autoComplete" type="search" dir="ltr" spellcheck=false autocorrect="off" autocomplete="off" autocapitalize="off" placeholder="馃攳 Type f to search for ..."> </div> <div class="control" title="Search options"> <a class="button is-primary js-modal-trigger" data-target="options-search-info"> <span class="icon"> <i class="fas fa-cogs"></i> </span> </a> </div> </div> </div> </div> <div id="options-search-info" class="modal"> <div class="modal-background"></div> <div class="modal-content"> <div class="box"> <p>The last search was: <span id="selected-candidate" class="ss-selected"></span></p> <div class="control is-grouped is-grouped-centered options-search-controls"> <label class="centreToggle" title="Include extra information (Alt-E)" style="--switch-width: 10.5"> <input id="options-search-extra" type="checkbox"> <span class="text">Extra info</span> <span class="on">yes</span> <span class="off">no</span> </label> <p>The search response can be shortened by excluding the extra information line (Alt-E)</p> <label class="centreToggle" title="Search engine type Strict/Loose (Alt-L)" style="--switch-width: 10.5"> <input id="options-search-loose" type="checkbox"> <span class="text">Search type</span> <span class="on">loose</span> <span class="off">strict</span> </label> <p> The search engine can perform a strict search (only the characters in the search box) or a loose search (Alt-L)</p> <label class="centreToggle" title="Search in headings (Alt-H)" style="--switch-width: 10.5"> <input id="options-search-headings" type="checkbox"> <span class="text">Headings</span> <span class="on">yes</span> <span class="off">no</span> </label> <p>Search through headings in all web-pages (Alt-H)</p> <label class="centreToggle" title="Search indexed items (Alt-I)" style="--switch-width: 10.5"> <input id="options-search-indexed" type="checkbox"> <span class="text">Indexed</span> <span class="on">yes</span> <span class="off">no</span> </label> <p>Search through all indexed items (Alt-I)</p> <label class="centreToggle" title="Search composite pages (Alt-C)" style="--switch-width: 10.5"> <input id="options-search-composite" type="checkbox"> <span class="text">Composite</span> <span class="on">yes</span> <span class="off">no</span> </label> <p>Search in the names of composite pages, which combine similar information from the main web pages (Alt-C)</p> <label class="centreToggle" title="Search primary sources (Alt-P)" style="--switch-width: 10.5"> <input id="options-search-primary" type="checkbox"> <span class="text">Primary</span> <span class="on">yes</span> <span class="off">no</span> </label> <p>Search through the names of the main web pages (Alt-P)</p> <label class="centreToggle" title="Open in new tab (Alt-Q)" style="--switch-width: 10.5"> <input id="options-search-newtab" type="checkbox"> <span class="text">New tab</span> <span class="on">yes</span> <span class="off">no</span> </label> <p>Once a search candidate has been chosen, it can be opened in a new tab or in the current tab (Alt-Q)</p> <p>If all else fails, an item is added to use the Google search engine on the whole site</p> <button class="button is-warning" id="options-search-reset-defaults">Clear options, reset to defaults</button> <p>Exit this page by pressing <Escape>, or clicking on X or on the background.</p> </div> </div> </div> <button class="modal-close is-large" aria-label="close"></button> </div> </div> <div id="download-ebook" class="modal"> <div class="modal-background"></div> <div class="modal-content"> <div class="box"> <p><a href="/RakuDocumentation.epub" download>RakuDocumentation.epub</a> is a work in progress e-book. It targets the <a href="https://www.w3.org/publishing/epub3/">EPUB v3 specification</a>. It needs testing on a variety of ereaders (some of which may still implicitly expect compliance with EPUB v2). The CSS definitely needs enhancing (especially for code snippets). The Ebook opens in a Calibre reader, which is available on all operating systems.</p> <p>Suggestions are welcome and should be addressed by opening an issue on the Raku/doc-website repository</p> <p>Exit this popup by pressing <Escape>, or clicking on X or on the background.</p> </div> </div> <button class="modal-close is-large" aria-label="close"></button> </div> <div id="announcement-modal" class="modal"> <div class="modal-background"></div> <div class="modal-content"> <div class="box"> <div id="raku-doc-announcement"></div> <p>For more see <a href="/announcements">Announcements page</a>.</p> <p>Exit this popup by pressing <Escape>, or clicking on X or on the background.</p> </div> </div> <button class="modal-close is-large" aria-label="close"></button> </div> </div> </nav> <div class="tile is-ancestor section"> <div class="page-edit"> <a class="button page-edit-button" href="https://github.com/Raku/doc-website/edit/main/Website/structure-sources/introduction.rakudoc" title="Edit this page. Commit: 82a5fb4 2023-09-13"> <span class="icon is-right"> <i class="fas fa-pen-alt is-medium"></i> </span> </a> </div> <div id="left-column" class="tile is-parent is-2 is-hidden"> <div id="left-col-inner"> <div class="tabs" id="tabs"> <ul> <li class="is-active" id="toc-tab"> <a>Table of Contents</a> </li> <li id="index-tab"> <a>Index</a> </li> </ul> </div> <div class="field"> <div class="control has-icons-right"> <input id="toc-filter" class="input" type="text" placeholder="Filter"> <span class="icon is-right has-text-grey"> <i class="fas fa-search is-medium"></i> </span> </div> </div> <div class="raku-sidebar"> <aside id="toc-menu" class="menu"> <ul class="menu-list"> <li><a href="#Getting_started">Getting started</a></li> <li><a href="#Migration_guides">Migration guides</a></li> <li><a href="#Tutorials">Tutorials</a></li> </ul> </aside> <aside id="index-menu" class="menu is-hidden"> </aside> </div> </div> </div> <div id="main-column" class="tile is-parent" style="overflow-x: hidden;"> <div id="main-col-inner"> <section class="raku page-header"> <div class="container px-4"> <div class="raku page-title has-text-centered"> Raku language documentation </div> <div class="raku page-subtitle has-text-centered"> <p>Introductory material, tutorials and migration guides for users familiar with other languages.</p> </div> </div> </section> <section class="raku page-content"><div class="container"><div class="columns listing"><div class="listf-container" id="Getting_started"> <div class="listf-file"><p class="listf-caption">Getting started</p> <a class="listf-link" href="language/about">About the docs</a><p>How to contribute to Raku and to the documents, how to generate the docs locally</p></div><div class="listf-file"><a class="listf-link" href="announcements">Announcements page</a><p>A date-stamped list of notes relevant to the Raku documentation site.</p></div><div class="listf-file"><a class="listf-link" href="language/intro">Brief introduction</a><p>Using Raku official documentation</p></div><div class="listf-file"><a class="listf-link" href="language/filename-extensions">Filename extensions</a><p>The extensions recommended for files with Raku content.</p></div><div class="listf-file"><a class="listf-link" href="language/101-basics">Raku by example 101</a><p>A basic introductory example of a Raku program</p></div></div><div class="listf-container" id="Migration_guides"> <div class="listf-file"><p class="listf-caption">Migration guides</p> <a class="listf-link" href="language/haskell-to-p6">Haskell to Raku - nutshell</a><p>Learning Raku from Haskell, in a nutshell</p></div><div class="listf-file"><a class="listf-link" href="language/js-nutshell">JavaScript (Node.js) to Raku - nutshell</a><p>Learning Raku from Node.js, in a nutshell</p></div><div class="listf-file"><a class="listf-link" href="language/5to6-perlfunc">Perl to Raku guide - functions</a><p>Builtin functions in Perl to Raku</p></div><div class="listf-file"><a class="listf-link" href="language/5to6-nutshell">Perl to Raku guide - in a nutshell</a><p>How do I do what I used to do? (Raku in a nutshell)</p></div><div class="listf-file"><a class="listf-link" href="language/5to6-perlop">Perl to Raku guide - operators</a><p>Operators in Perl to Raku: equivalencies and variations</p></div><div class="listf-file"><a class="listf-link" href="language/5to6-overview">Perl to Raku guide - overview</a><p>How do I do what I used to do?</p></div><div class="listf-file"><a class="listf-link" href="language/5to6-perlvar">Perl to Raku guide - special variables</a><p>A comparison of special variables in Perl and Raku</p></div><div class="listf-file"><a class="listf-link" href="language/5to6-perlsyn">Perl to Raku guide - syntax</a><p>Syntactic differences between Perl and Raku</p></div><div class="listf-file"><a class="listf-link" href="language/py-nutshell">Python to Raku - nutshell</a><p>Learning Raku from Python, in a nutshell</p></div><div class="listf-file"><a class="listf-link" href="language/rb-nutshell">Ruby to Raku - nutshell</a><p>Learning Raku from Ruby, in a nutshell: what do I already know?</p></div></div><div class="listf-container" id="Tutorials"> <div class="listf-file"><p class="listf-caption">Tutorials</p> <a class="listf-link" href="language/classtut">Classes and objects</a><p>A tutorial about creating and using classes in Raku</p></div><div class="listf-file"><a class="listf-link" href="language/create-cli">Command line interface</a><p>Creating your own CLI in Raku</p></div><div class="listf-file"><a class="listf-link" href="language/compilation">CompUnits and where to find them</a><p>How and when Raku modules are compiled, where they are stored, and how to access them in compiled form.</p></div><div class="listf-file"><a class="listf-link" href="language/concurrency">Concurrency</a><p>Concurrency and asynchronous programming</p></div><div class="listf-file"><a class="listf-link" href="language/modules-core">Core modules</a><p>Core modules that may be useful to module authors</p></div><div class="listf-file"><a class="listf-link" href="language/optut">Creating operators</a><p>A short tutorial on how to declare operators and create new ones.</p></div><div class="listf-file"><a class="listf-link" href="language/math">Doing math with Raku</a><p>Different mathematical paradigms and how they are implemented in this language</p></div><div class="listf-file"><a class="listf-link" href="language/unicode_entry">Entering unicode characters</a><p>Input methods for unicode characters in terminals, the shell, and editors</p></div><div class="listf-file"><a class="listf-link" href="language/grammar_tutorial">Grammar tutorial</a><p>An introduction to grammars</p></div><div class="listf-file"><a class="listf-link" href="language/io">Input/Output</a><p>File-related operations</p></div><div class="listf-file"><a class="listf-link" href="language/ipc">Inter-process communication</a><p>Programs running other programs and communicating with them</p></div><div class="listf-file"><a class="listf-link" href="language/iterating">Iterating</a><p>Functionalities available for visiting all items in a complex data structure</p></div><div class="listf-file"><a class="listf-link" href="language/modules-extra">Module development utilities</a><p>What can help you write/test/improve your module(s)</p></div><div class="listf-file"><a class="listf-link" href="language/module-packages">Module packages</a><p>Creating module packages for code reuse</p></div><div class="listf-file"><a class="listf-link" href="language/modules">Modules</a><p>How to create, use, and distribute Raku modules</p></div><div class="listf-file"><a class="listf-link" href="language/REPL">REPL</a><p>Read-eval-print loop</p></div><div class="listf-file"><a class="listf-link" href="language/regexes-best-practices">Regexes: best practices and gotchas</a><p>Some tips on regexes and grammars</p></div></div> </div></div></section> </div> </div> </div> <footer class="footer main-footer"> <div class="container px-4"> <nav class="level"> <div class="level-left"> <div class="level-item"> <a href="/about">About</a> </div> <div class="level-item"> <a id="toggle-theme">Toggle theme</a> </div> <div class="level-item" title="82a5fb4 2023-09-13"> <a>Commit</a> </div> </div> <div class="level-right"> <div class="level-item"> <a href="/license">License</a> </div> </div> </nav> </div> </footer> </body> </html>