viernes, 24 de abril de 2009

little update

4 days after my first perl6 script. It's already outdated. You see, rakudo is a fast moving target.

Last thursday, parrot 1.1 was out, and it comes with lots of changes compared to parrot 1.0.

One of the strange syntax present in my last script, was a line like:
while my $tat = =$*IN { ... }

In that case, the first = is the well known assignation, and the second = was a prefix operator, that took the next element of the list that was preceeding.

= as a prefix operator has been deprecated in favour of '.get' function .

so that code, now would be like


sub printa_rusc($f, $c){

my $first = ' - ' x $c ;
$first.chop.say; #chop is non

my $top_line = '/ \_' x $c;
my $bottom_line = '\_/ ' x $c;

for 1..$f {

while my $tat = $*IN.get {
my @arr=$tat.split(/\s+/);
if 2==@arr.elems {
printa_rusc(@arr[0], @arr[1]); #not $arr[0]
} else {
"Bad format. Enter only 2 integers".say;

# vim: set tabstop=4 shiftwidth=4 foldmethod=marker ft=perl: ##
Nothing else for the moment