fusionplant.com


UTC 10:11:12
Thursday
11/21/2024



November 2024
SuMoTuWeThFrSa 
     12 
3456789 
10111213141516 
17181920212223 
24252627282930 
        
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];