📘 Hello, World! in Perl 6

Print ‘Hello, World!’ There are two built-in functions in Perl 6 to print to the console: printand say. Both print their arguments, but the say routine additionally ends the output with a newline character. So, the quickest solution is to use sayand pass a string with no newlines: say ‘Hello, World!’ Another solution is to use print and include the \n character … Continue reading “📘 Hello, World! in Perl 6”

📘 How to debug Perl 6 programs

For quick tests, use the compiler in the mode of the REPL (read—eval—print loop) shell. Just run the perl6 command: $ perl6To exit type ‘exit’ or ‘^D’>  With bigger programs, one of the following techniques helps to visualise data: 1. The say routine is used as a stand-alone function or as an object method. It works well … Continue reading “📘 How to debug Perl 6 programs”

🦋 109. 42 via the cubes

In the recent days, you might have seen the calculation that leads to getting an exact value of 42, the answer of Life, the Universe and Everything. Let me copy it here, using the power of Perl 6 and its arbitrary precision arithmetics , not to mention the coolness of using superscripts directly in the … Continue reading “🦋 109. 42 via the cubes”