fusionplant.com


UTC 04:26:51
Saturday
4/27/2024



April 2024
SuMoTuWeThFrSa 
 123456 
78910111213 
14151617181920 
21222324252627 
282930     
        
Calendar Tool

welcome

A Taste of Perl 6 on Perl 5



Perl 6 is still in the works. It will be a while before it is officially released. But here's some of the proposed functions.

say
Perl6::Say

print "Hello, World!\n";
This sends some text and a new line feed to standard output. You may forget to add the new line feed and it gets tiresome to keep having to put the "\n" at the end everytime.
Instead, you can just say "Hello, World!"; and be done. Its pretty simple. The module is very small.

slurp
Perl6::Slurp
Slurp opens a file and returns its contents to a variable.
$myFile = slurp "file1.txt";

io()
IO::All

Get standard input:
$line < io('-');
Multiple lines can be assigned to $line.

Write a line to a file:
$line > io("file1.txt");
Use > to write (or clobber) a file or >> to append. Use < to Read.

Get line 10 from a file:
$line = io('file1.txt')->[9];