📘 Postfix operator - - in Perl 6

📘 Postfix operator - - in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.


- - is a postfix decrement.

Both postfix and prefix operators magically know how to deal with numbers in filenames.

my $filename = 'file01.txt';
for 1..10 {
    say $filename++;
}

This example prints the list of the filenames with incrementing numbers: file01.txt, file02.txt, … file10.txt.

Leave a Reply

Your email address will not be published. Required fields are marked *